Skip to content

Add system column support to the USING clause #3

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hilltracer
Copy link
Owner

@hilltracer hilltracer commented Sep 12, 2024

Add system column support to the USING clause

Problem: The parser can't handle USING joins with system columns, such as xmin.

Solution:

  1. Use the scanNSItemForColumn() function instead of buildVarFromNSColumn() for
    constructing Var objects, as it correctly handles system columns.
  2. Remove extra calls to markVarForSelectPriv(), since this function is already
    invoked in scanNSItemForColumn().
  3. For system columns, collect their negative attribute numbers along with
    user-defined column indices into l_colnos and r_colnos.
  4. Create a buildVarFromSystemAttribute() function for rebuilding Var objects
    with system attributes, analogous to buildVarFromNSColumn(), since
    scanNSItemForColumn() is complex and has side effects.
  5. Implement a fillNSColumnParametersFromVar() function for building NS columns
    with system attributes.
  6. Add SystemAttributeTotalNumber() function to heap.c to ensure memory for
    res_nscolumns is allocated with system columns in mind.

@hilltracer hilltracer force-pushed the using_with_system_columns branch 3 times, most recently from 0595be4 to 295f9ec Compare September 13, 2024 08:01
Problem: The parser can't handle USING joins with system columns, such as xmin.

Solution:
1. Use the scanNSItemForColumn() function instead of buildVarFromNSColumn() for
constructing Var objects, as it correctly handles system columns.
2. Remove extra calls to markVarForSelectPriv(), since this function is already
invoked in scanNSItemForColumn().
3. For system columns, collect their negative attribute numbers along with
user-defined column indices into l_colnos and r_colnos.
4. Create a buildVarFromSystemAttribute() function for rebuilding Var objects
with system attributes, analogous to buildVarFromNSColumn(), since
scanNSItemForColumn() is complex and has side effects.
5. Implement a fillNSColumnParametersFromVar() function for building NS columns
with system attributes.
6. Add SystemAttributeTotalNumber() function to heap.c to ensure memory for
res_nscolumns is allocated with system columns in mind.
@hilltracer hilltracer force-pushed the using_with_system_columns branch from 295f9ec to 9d1f344 Compare September 13, 2024 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant