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

Create table unique index parameters problem fixed #287

Closed
wants to merge 5 commits into from

Conversation

emin100
Copy link
Contributor

@emin100 emin100 commented May 26, 2023

SQL: CREATE TABLE distributors (         
              did     int,
              name    varchar(40),
              UNIQUE (name) WITH (fillfactor=70)
            )
            WITH (fillfactor=70);
Failure/Error: it { is_expected.to eq oneline_query }

       expected: "CREATE TABLE distributors (did int, name varchar(40), UNIQUE (name) WITH (fillfactor=70)) WITH (fillfactor=70)"
            got: "CREATE TABLE distributors (did int, name varchar(40), UNIQUE (name)) WITH (fillfactor=70)"

              did     int,
              name    varchar(40),
              UNIQUE (name) WITH (fillfactor=70)
            )
            WITH (fillfactor=70);
Failure/Error: it { is_expected.to eq oneline_query }

       expected: "CREATE TABLE distributors (did int, name varchar(40), UNIQUE (name) WITH (fillfactor=70)) WITH (fillfactor=70)"
            got: "CREATE TABLE distributors (did int, name varchar(40), UNIQUE (name)) WITH (fillfactor=70)"
@lfittl
Copy link
Member

lfittl commented May 26, 2023

@emin100 Thanks for the contribution!

For deparser changes, we would actually need to add this in the C library (https://github.com/pganalyze/libpg_query), and then update the source here. Do you want to open a PR there? You can add the test case to the deparse_tests.c file.

@emin100
Copy link
Contributor Author

emin100 commented May 26, 2023

@lfittl thanks for the reply. I will open PR to libpg_query.

@emin100
Copy link
Contributor Author

emin100 commented May 27, 2023

@lfittl I opened a new PR to libpg_query repo.
PR: pganalyze/libpg_query#193

emin100 pushed a commit to emin100/extract_postgresql_documentation_sql_examples that referenced this pull request May 30, 2023
expected: "SHOW ALL"
got: "SHOW SESSION ALL"

libpg_query PR: pganalyze/libpg_query#193
@emin100
Copy link
Contributor Author

emin100 commented Jun 2, 2023

fixed another deparse problem

SQL: SHOW ALL

expected: "SHOW ALL"
got: "SHOW SESSION ALL"

libpg_query PR: pganalyze/libpg_query#193

CREATE PROCEDURE insert_data(a integer, b integer)
LANGUAGE SQL
BEGIN ATOMIC
  INSERT INTO tbl VALUES (a);
  INSERT INTO tbl VALUES (b);
END;

ERROR for "CREATE PROCEDURE insert_data(a int, b int) LANGUAGE sql BEGIN ATOMIC INSERT INTO tbl VALUES (a); INSERT INTO tbl VALUES (b); END"
  deparse: unpermitted node type in a_expr/b_expr: 231
@emin100
Copy link
Contributor Author

emin100 commented Jun 7, 2023

SQL:
CREATE PROCEDURE insert_data(a integer, b integer)
LANGUAGE SQL
BEGIN ATOMIC
  INSERT INTO tbl VALUES (a);
  INSERT INTO tbl VALUES (b);
END;

ERROR for "CREATE PROCEDURE insert_data(a int, b int) LANGUAGE sql BEGIN ATOMIC INSERT INTO tbl VALUES (a); INSERT INTO tbl VALUES (b); END"
  deparse: unpermitted node type in a_expr/b_expr: 231

libpg_query PR: pganalyze/libpg_query#195

@seanlinsley
Copy link
Member

From the history here it looks like this has been fixed in libpg_query, so I'll close this.

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.

3 participants