Skip to content
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

Update age_load to load scalar property values with appropriate type (#1519) (#1525) #1581

Merged
merged 3 commits into from
Feb 9, 2024

Conversation

rafsun42
Copy link
Member

@rafsun42 rafsun42 commented Feb 9, 2024

Conflicts:
src/backend/utils/load/ag_load_labels.c
src/backend/utils/load/age_load.c
src/include/utils/load/ag_load_edges.h
src/include/utils/load/age_load.h

…pache#1519) (apache#1525)

Previously, property values from csv files were always loaded as strings. This
patch adds a boolean function parameter `load_as_agtype`. When this parameter
is true, values are converted to an appropriate scalar type (i.e. string, bool,
numeric, null) while loading. Otherwise, values are loaded as string. It uses
the agtype_value_from_cstring() function for conversion.

Additional change(s):
-------------------
 - Fix: for csv rows in edge files, create_agtype_from_list_i()'s start_index
   is corrected to 4

Note:
----
 - It applies both patch 1519 and 1525.

Conflicts:
        src/backend/utils/load/ag_load_labels.c
        src/backend/utils/load/age_load.c
        src/include/utils/load/ag_load_edges.h
        src/include/utils/load/age_load.h
The json_validate() function is borrowed from PG16 with minor changes.
Because it does not exist in other versions of PG.
For PG12 and below, pg_parse_json() does not return an error code.
A TRY-CATCH block is used to catch errors and return false instead.
@github-actions github-actions bot added the PG11 PostgreSQL11 label Feb 9, 2024
@jrgemignani jrgemignani merged commit d993734 into apache:PG11 Feb 9, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PG11 PostgreSQL11
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants