1294{
1298
1299
1300
1301
1302
1303
1310 {
1312 (
errmsg(
"relation \"%s\" does not exist, skipping",
1313 stmt->pgname->relname)));
1315 }
1316
1318
1319 foreach(
lc,
stmt->add_vertex_tables)
1320 {
1325
1328
1330
1332
1336 errmsg(
"cannot add temporary element table to non-temporary property graph"),
1339
1340 if (
vertex->vtable->alias)
1341 vinfo->aliasname =
vertex->vtable->alias->aliasname;
1342 else
1344
1346
1348
1350
1356 errmsg(
"alias \"%s\" already exists in property graph \"%s\"",
1357 vinfo->aliasname,
stmt->pgname->relname),
1359
1361
1365 }
1366
1367 foreach(
lc,
stmt->add_edge_tables)
1368 {
1375
1378
1380
1382
1386 errmsg(
"cannot add temporary element table to non-temporary property graph"),
1389
1390 if (
edge->etable->alias)
1391 einfo->aliasname =
edge->etable->alias->aliasname;
1392 else
1393 einfo->aliasname =
edge->etable->relname;
1394
1396
1399
1402
1405
1407 einfo->aliasname,
edge->location,
"SOURCE",
1410 einfo->aliasname,
edge->location,
"DESTINATION",
1412
1414
1417
1419
1425 errmsg(
"alias \"%s\" already exists in property graph \"%s\"",
1426 einfo->aliasname,
stmt->pgname->relname),
1428
1430
1434 }
1435
1436 foreach(
lc,
stmt->drop_vertex_tables)
1437 {
1441
1445 }
1446
1447 foreach(
lc,
stmt->drop_edge_tables)
1448 {
1452
1456 }
1457
1458
1459 if (
stmt->drop_vertex_tables ||
stmt->drop_edge_tables)
1460 {
1462 {
1464 {
1466
1469 }
1470 }
1471 }
1472
1473 foreach(
lc,
stmt->add_labels)
1474 {
1479
1481
1484 else
1486
1488
1491
1495 }
1496
1497 if (
stmt->drop_label)
1498 {
1508
1511 else
1513
1521 errmsg(
"property graph \"%s\" element \"%s\" has no label \"%s\"",
1524
1525
1526
1527
1528
1529
1530
1540 {
1542
1544
1547
1549 break;
1550 }
1553
1557 errmsg(
"property graph \"%s\" element \"%s\" has no label \"%s\"",
1560
1561
1562
1563
1564
1568 errmsg(
"cannot drop the last label from element \"%s\"",
1569 stmt->element_alias),
1570 errhint(
"Every element must have at least one label.")));
1571
1574
1575
1577 {
1580 }
1581 }
1582
1583 if (
stmt->add_properties)
1584 {
1589
1592 else
1594
1607 errmsg(
"property graph \"%s\" element \"%s\" has no label \"%s\"",
1610
1612
1614
1618 }
1619
1620 if (
stmt->drop_properties)
1621 {
1626
1629 else
1631
1641
1645 errmsg(
"property graph \"%s\" element \"%s\" has no label \"%s\"",
1648
1649 foreach(
lc,
stmt->drop_properties)
1650 {
1654
1667 errmsg(
"property graph \"%s\" element \"%s\" label \"%s\" has no property \"%s\"",
1670
1673 }
1674
1676 }
1677
1678
1679 if (
stmt->drop_properties ||
stmt->drop_vertex_tables ||
stmt->drop_edge_tables ||
stmt->drop_label)
1680 {
1682 {
1686
1692
1695 {
1697
1700 }
1701
1704 }
1705 }
1706
1707
1708
1709
1710
1711
1713
1715}
#define Assert(condition)
void performDeletion(const ObjectAddress *object, DropBehavior behavior, int flags)
int errcode(int sqlerrcode)
int errhint(const char *fmt,...) pg_attribute_printf(1
int errdetail(const char *fmt,...) pg_attribute_printf(1
#define ereport(elevel,...)
#define palloc0_object(type)
void systable_endscan(SysScanDesc sysscan)
HeapTuple systable_getnext(SysScanDesc sysscan)
SysScanDesc systable_beginscan(Relation heapRelation, Oid indexId, bool indexOK, Snapshot snapshot, int nkeys, ScanKey key)
#define HeapTupleIsValid(tuple)
static void * GETSTRUCT(const HeapTupleData *tuple)
void CacheInvalidateRelcacheByRelid(Oid relid)
#define ShareRowExclusiveLock
char * get_rel_name(Oid relid)
char get_rel_persistence(Oid relid)
Oid RangeVarGetRelidExtended(const RangeVar *relation, LOCKMODE lockmode, uint32 flags, RangeVarGetRelidCallback callback, void *callback_arg)
const ObjectAddress InvalidObjectAddress
#define ObjectAddressSet(addr, class_id, object_id)
int parser_errposition(ParseState *pstate, int location)
@ PROPGRAPH_ELEMENT_KIND_VERTEX
#define lfirst_node(type, lc)
#define foreach_oid(var, lst)
END_CATALOG_STRUCT typedef FormData_pg_propgraph_element_label * Form_pg_propgraph_element_label
static Datum ObjectIdGetDatum(Oid X)
static Datum CStringGetDatum(const char *X)
static void check_all_labels_properties(Oid pgrelid)
static Oid get_edge_oid(ParseState *pstate, Oid pgrelid, const char *alias, int location)
static Oid get_element_relid(Oid peid)
static Oid get_vertex_oid(ParseState *pstate, Oid pgrelid, const char *alias, int location)
static void insert_property_records(Oid graphid, Oid ellabeloid, Oid pgerelid, const PropGraphProperties *properties)
static Oid insert_label_record(Oid graphid, Oid peoid, const char *label)
static void check_element_label_properties(Oid ellabeloid)
static List * get_graph_label_ids(Oid graphid)
static Oid insert_element_record(ObjectAddress pgaddress, struct element_info *einfo)
static List * get_label_element_label_ids(Oid labelid)
static List * get_graph_property_ids(Oid graphid)
static void check_element_properties(Oid peoid)
static ArrayType * propgraph_element_get_key(ParseState *pstate, const List *key_clause, Relation element_rel, const char *aliasname, int location)
static void propgraph_edge_get_ref_keys(ParseState *pstate, const List *keycols, const List *refcols, Relation edge_rel, Relation ref_rel, const char *aliasname, int location, const char *type, ArrayType **outkey, ArrayType **outref, ArrayType **outeqop)
void ScanKeyInit(ScanKey entry, AttrNumber attributeNumber, StrategyNumber strategy, RegProcedure procedure, Datum argument)
#define BTEqualStrategyNumber
#define SearchSysCacheExists2(cacheId, key1, key2)
#define GetSysCacheOid2(cacheId, oidcol, key1, key2)
void table_close(Relation relation, LOCKMODE lockmode)
Relation table_open(Oid relationId, LOCKMODE lockmode)
void RangeVarCallbackOwnsRelation(const RangeVar *relation, Oid relId, Oid oldRelId, void *arg)
void CommandCounterIncrement(void)