-
Notifications
You must be signed in to change notification settings - Fork 420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement multiple label #1452
Implement multiple label #1452
Conversation
hello :-) i have tried this while looking for a way to use but i couldn't compile (probably because i misunderstand something). here is the output of
here is the output of
i am running postgresql 15 on Debian 11 bullseye, installed with these debian apt packages:
i have tried on these PG15 branchs of AGE (for both, in META.JSON file, the version is said to be
it's probably meaningless but to make AGE compile, i had to install two deps from debian apt packages: |
@thjbdvlt Did you do |
@rafsun42 i didn't, but with (plus, as i now have a small partition on my computer dedicated to postgresql 15/age/pr 1452, i can easily try things) |
@thjbdvlt After some digging, I figured out this branch indeed does not compile with a PostgreSQL copy compiled with the I pushed a commit to address this issue. Let me know if it compiles now. |
@rafsun42 it does compile! |
This Feature is huge, not only for openCypher compliance. A merge would be much appreciated. I am using graph databases mostly as backend for traditional OLTP Applications, as opposed to data analysis. For me the most common use case for union style relation type queries is, to enforce constraints on your relations by checking for forbidden combinations before creating an edge. Example 1Imagine a graph with vertices representing persons Example 2Imagine a graph for task planning. Tasks
To add to the complexity, any combination of both edge types in any path length are a problem and can (within reasonable effort) only be detected like this:
Almost feels like a prime example for the power of graph databases. And if you don't want to use this feature in an OLTP context, you sure want to be able to find these conditions in your dataset. |
@rafsun42 Could this be rebased with the master and applied to the master branch instead of PG15? I'm not saying not to do PG15, just get it on the master first. Thoughts? |
@rafsun42 Additionally, it states that there are conflicts? |
@jrgemignani Sure, John. I will rebase this to latest master. |
It represents label expression of different type: empty, single or multiple.
Previously, label field was char* type. The change affected the type cypher_node, cypher_relationship and cypher_target_node. As well as, any places where these types are used.
Supports queries like- MATCH (v:A|B|C) RETURN v MATCH ()-[e:A|B|C]->() RETURN v
Some examples of supported multiple label queries: CREATE (:a:b) MERGE (:a:b) MATCH (:a:b) MATCH (:a|b) See regress/sql/multiple_label.sql for more details on what kind of queries are supported. Change summary: --------------- * A new column `allrelations` is added to ag_label catalog * Change in creating AGE relations logic * Change in MATCH's transformation logic (related to building parse namespace item)
The logic for building vertex objects is updated. Agtype vertex objects can be built from either a single label (as a cstring) or multiple labels (as an agtype array). The following functions are updated to reflect this- agtype_typecast_vertex, agtype_in and _agtype_build_vertex. if _agtype_build_vertex is called from SQL, its label argument must be explicitly cast to avoid ambiguity in function overload. The `_label_names` function is added to extract label names from a vertex ID as a list of string. It is used as a helper function to build vertex objects. A new cache called `allrelations` is also added. This is used by _label_names to search for all labels that are related to a given relation. Multiple helper functions are added to extract label infromation from an entity ID. For example, entity's relation ID, relation name, label names. These are used by CREATE, DELETE, MERGE, VLE and SET executors for building a vertex's object or updating its relation. All test files are updated to show the label field as an array in the output. In all test SQLs, _agtype_build_vertex's label argument is explicity cast.
It updates the function filter_vertices_on_label_id(). Additional changes: ------------------- - Add internal function _label_ids
Cache issues fixed: ------------------- - Use of wrong data type for cache entry in label relation cache (pre-existing) - Use of wrong update function for catalog table (related to multiple label) Other changes: -------------- - The function _label_name() is unsupported for vertices
Changes: -------- - Update create_label_expr_relations() to return RangeVar. It removes redundant call to label_expr_relname() in the code that also calls this function. - Use deconstruct_array() to convert ArrayType* to List* - Update test files after rebase
This fixes some compile-time errors that occur if PostgreSQL is configured with the --with-llvm option.
Changes: ------- * Include missing header files * Update newly added tests * Other minor changes
Following PRs are reapplied: 1465, 1509, 1514, and 1518.
f8fb72e
to
55750e4
Compare
After rebase, moved to a new PR #1785. |
Add support for multiple labels in CREATE, MERGE and MATCH clause.
Important Notes: