Skip to content

Commit

Permalink
Fix cursor quoting in FetchStmt
Browse files Browse the repository at this point in the history
Regression tests updated to test all cursor related statement with a name that
requires quoting.
  • Loading branch information
rjuju authored and msepga committed Oct 31, 2024
1 parent 7fb9821 commit 5a3fa6e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/postgres_deparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -8707,7 +8707,7 @@ static void deparseFetchStmt(StringInfo str, FetchStmt *fetch_stmt)
appendStringInfo(str, "RELATIVE %ld ", fetch_stmt->howMany);
}

appendStringInfoString(str, fetch_stmt->portalname);
appendStringInfoString(str, quote_identifier(fetch_stmt->portalname));
}

static void deparseAlterDefaultPrivilegesStmt(StringInfo str, AlterDefaultPrivilegesStmt *alter_default_privileges_stmt)
Expand Down
8 changes: 4 additions & 4 deletions test/sql/postgres_regress/portals.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

BEGIN;

DECLARE foo1 SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2;
DECLARE "Foo1" SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2;

DECLARE foo2 SCROLL CURSOR FOR SELECT * FROM tenk2;

Expand Down Expand Up @@ -50,7 +50,7 @@ DECLARE foo22 SCROLL CURSOR FOR SELECT * FROM tenk2;

DECLARE foo23 SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2;

FETCH 1 in foo1;
FETCH 1 in "Foo1";

FETCH 2 in foo2;

Expand Down Expand Up @@ -140,9 +140,9 @@ FETCH backward 21 in foo3;

FETCH backward 22 in foo2;

FETCH backward 23 in foo1;
FETCH backward 23 in "Foo1";

CLOSE foo1;
CLOSE "Foo1";

CLOSE foo2;

Expand Down

0 comments on commit 5a3fa6e

Please sign in to comment.