fix(plpgsql-deparser): expand PLpgSQL_row fields when refname is '(unnamed row)' #265
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fix(plpgsql-deparser): expand PLpgSQL_row fields when refname is '(unnamed row)'
Summary
Fixes a bug where
SELECT INTOandEXECUTE ... INTOstatements targeting variables would outputINTO (unnamed row)instead of the actual variable names likeINTO v_rowcount.When PostgreSQL parses a
SELECT INTOstatement, it creates aPLpgSQL_rowdatum withrefnameset to"(unnamed row)". The actual variable names are stored in thefieldsarray withvarnoreferences that point to the real variables in thedatumsarray.This fix modifies
deparseDatumName()to:contextparameter to access the datums arrayPLpgSQL_row.refnameis"(unnamed row)"All callers of
deparseDatumName()have been updated to pass the context parameter.Review & Testing Checklist for Human
deparseDatumName()now pass thecontextparameter (lines 772, 813, 844, 1060, 1088, 1110, 1227, 1307, 1331)app_limits_incfunction no longer hasINTO (unnamed row)syntax errorsTest Plan
pnpm run generate:metaschema-rlsto regenerate the constructive moduleapplication/constructive/deploy/schemas/constructive_limits_private/procedures/have correctINTOclausespnpm test -- rls.modular.test.tsto verify RLS tests passNotes