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

Table like clause issue #91

Merged
merged 3 commits into from
Mar 21, 2021
Merged

Conversation

lelit
Copy link
Contributor

@lelit lelit commented Mar 20, 2021

Hi Lukas,

while working on my pglast deparser I noticed that the following statement

CREATE TABLE like_constraint_rename_cache   (LIKE constraint_rename_cache INCLUDING ALL)

gets deparsed by current libpg_query as

CREATE TABLE like_constraint_rename_cache (LIKE constraint_rename_cache INCLUDING ALL INCLUDING COMMENTS INCLUDING CONSTRAINTS INCLUDING DEFAULTS INCLUDING IDENTITY INCLUDING GENERATED INCLUDING INDEXES INCLUDING STATISTICS INCLUDING STORAGE)

It seems redundant, isn't it? If so, it this PR reasonable?

Unfortunately I could not run the tests locally, because a make stopped with

...
compiling src/postgres/src_port_strerror.c
compiling src/postgres/src_port_strnlen.c
compiling vendor/protobuf-c/protobuf-c.c
compiling vendor/xxhash/xxhash.c
Warning: protoc-gen-c not found, skipping protocol buffer regeneration
compiling protobuf/pg_query.pb-c.c
ar: Cannot convert existing thin library libpg_query.a to normal format
make: *** [Makefile:145: libpg_query.a] Errore 1

and I could not figure out what's wrong here... I'm on a Debian sid, if that matters.

When the option is CREATE_TABLE_LIKE_ALL there's no need to explicitly list all other values.
@lfittl
Copy link
Member

lfittl commented Mar 20, 2021

@lelit Nice, good catch!

I wonder if we should add this as an explicit test to the list in test/deparse_tests.c? (those are checked for matching 1:1 in the text - the regression tests are only checked for matching in the parse tree, but not in the exact text representation)

(I'll review the issue you've reported on running the tests separately - need to boot a VM with Debian sid to confirm)

@lelit
Copy link
Contributor Author

lelit commented Mar 20, 2021

Thanks!

@lfittl
Copy link
Member

lfittl commented Mar 20, 2021

@lelit I've just ran make successfully (including the tests) on Debian sid, including running all the tests.

Could it be that you have a leftover libpg_query.a library from an older version of libpg_query?

@lfittl lfittl merged commit 442b174 into pganalyze:13-latest Mar 21, 2021
@lelit lelit deleted the table-like-clause-issue branch March 21, 2021 11:43
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.

None yet

2 participants