Property graph: fix error handling when dropping non-existent label property
В списке pgsql-hackers по дате отправления:
| От | Chao Li |
|---|---|
| Тема | Property graph: fix error handling when dropping non-existent label property |
| Дата | |
| Msg-id | 1DA5D52A-4AFA-426E-83F7-42ED974D682B@gmail.com обсуждение |
| Ответы |
Re: Property graph: fix error handling when dropping non-existent label property
|
| Список | pgsql-hackers |
Hi, I am testing graph tables today and noticed an improper error message when dropping a property. Here is a simple repro: ``` evantest=# CREATE TABLE t1 (a int PRIMARY KEY, b int); CREATE TABLE evantest=# evantest=# CREATE PROPERTY GRAPH g evantest-# VERTEX TABLES ( evantest(# t1 evantest(# LABEL l1 PROPERTIES (a AS p1) evantest(# LABEL l2 PROPERTIES (b AS p2) evantest(# ); CREATE PROPERTY GRAPH evantest=# evantest=# ALTER PROPERTY GRAPH g evantest-# ALTER VERTEX TABLE t1 evantest-# ALTER LABEL l1 DROP PROPERTIES (p2); ERROR: could not find tuple for label property 0 ``` This does not look like a normal user-facing SQL error message. Looking into the code, AlterPropGraph() checks whether the property exists in the graph, but does not check if label propertyexists. As a result, InvalidOid can be passed to ObjectAddressSet() and then to performDeletion(). The fix is simple, just check the label-property OID before trying to delete it. I also added a regress test. With the patch, the error becomes: ``` evantest=# ALTER PROPERTY GRAPH g evantest-# ALTER VERTEX TABLE t1 evantest-# ALTER LABEL l1 DROP PROPERTIES (p2); ERROR: property graph "g" element "t1" label "l1" has no property "p2" ``` Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/
В списке pgsql-hackers по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера