1292{
1296
1297
1298
1299
1300
1301
1308 {
1310 (
errmsg(
"relation \"%s\" does not exist, skipping",
1311 stmt->pgname->relname)));
1313 }
1314
1316
1317 foreach(
lc,
stmt->add_vertex_tables)
1318 {
1323
1326
1328
1330
1334 errmsg(
"cannot add temporary element table to non-temporary property graph"),
1337
1338 if (
vertex->vtable->alias)
1339 vinfo->aliasname =
vertex->vtable->alias->aliasname;
1340 else
1342
1344
1346
1348
1354 errmsg(
"alias \"%s\" already exists in property graph \"%s\"",
1355 vinfo->aliasname,
stmt->pgname->relname),
1357
1359
1363 }
1364
1365 foreach(
lc,
stmt->add_edge_tables)
1366 {
1373
1376
1378
1380
1384 errmsg(
"cannot add temporary element table to non-temporary property graph"),
1387
1388 if (
edge->etable->alias)
1389 einfo->aliasname =
edge->etable->alias->aliasname;
1390 else
1391 einfo->aliasname =
edge->etable->relname;
1392
1394
1397
1400
1403
1405 einfo->aliasname,
edge->location,
"SOURCE",
1408 einfo->aliasname,
edge->location,
"DESTINATION",
1410
1412
1415
1417
1423 errmsg(
"alias \"%s\" already exists in property graph \"%s\"",
1424 einfo->aliasname,
stmt->pgname->relname),
1426
1428
1432 }
1433
1434 foreach(
lc,
stmt->drop_vertex_tables)
1435 {
1439
1443 }
1444
1445 foreach(
lc,
stmt->drop_edge_tables)
1446 {
1450
1454 }
1455
1456
1457 if (
stmt->drop_vertex_tables ||
stmt->drop_edge_tables)
1458 {
1460 {
1462 {
1464
1467 }
1468 }
1469 }
1470
1471 foreach(
lc,
stmt->add_labels)
1472 {
1477
1479
1482 else
1484
1486
1489
1493 }
1494
1495 if (
stmt->drop_label)
1496 {
1506
1509 else
1511
1519 errmsg(
"property graph \"%s\" element \"%s\" has no label \"%s\"",
1522
1523
1524
1525
1526
1527
1528
1538 {
1540
1542
1545
1547 break;
1548 }
1551
1555 errmsg(
"property graph \"%s\" element \"%s\" has no label \"%s\"",
1558
1559
1560
1561
1562
1566 errmsg(
"cannot drop the last label from element \"%s\"",
1567 stmt->element_alias),
1568 errhint(
"Every element must have at least one label.")));
1569
1572
1573
1575 {
1578 }
1579 }
1580
1581 if (
stmt->add_properties)
1582 {
1587
1590 else
1592
1605 errmsg(
"property graph \"%s\" element \"%s\" has no label \"%s\"",
1608
1610
1612
1616 }
1617
1618 if (
stmt->drop_properties)
1619 {
1624
1627 else
1629
1639
1643 errmsg(
"property graph \"%s\" element \"%s\" has no label \"%s\"",
1646
1647 foreach(
lc,
stmt->drop_properties)
1648 {
1652
1665 errmsg(
"property graph \"%s\" element \"%s\" label \"%s\" has no property \"%s\"",
1668
1671 }
1672
1674 }
1675
1676
1677 if (
stmt->drop_properties ||
stmt->drop_vertex_tables ||
stmt->drop_edge_tables ||
stmt->drop_label)
1678 {
1680 {
1684
1690
1693 {
1695
1698 }
1699
1702 }
1703 }
1704
1705
1706
1707
1708
1709
1711
1713}
#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)