Fix missing space before WHERE in GRAPH_TABLE deparse

get_graph_pattern_def() emitted the pattern-level WHERE keyword as
"WHERE " with no leading space, so reverse-parsing produced output
like "(o IS orders)WHERE (...)".  The element-level WHERE deparse in
get_path_pattern_expr_def() already prepends a separating space; the
pattern-level branch was inconsistent with it.  Emit " WHERE " to
match.

The output still re-parses to the same tree, so this is cosmetic.

For test coverage, add a whole-pattern WHERE clause to the existing
customers_us view, which is already reverse-parsed with
pg_get_viewdef().

Author: Dhruv Chauhan <[email protected]>
Reviewed-by: Ashutosh Bapat <[email protected]>
Discussion: 
https://www.postgresql.org/message-id/flat/CANWwWcpHb0h7tg6otRnL-FV83jwQpAiyw1bhvv8T78kpwZ-0ow%40mail.gmail.com

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/d2ac26eb9b1e8ad19fd526efb0ffff4fae5ed56f

Modified Files
--------------
src/backend/utils/adt/ruleutils.c         |  2 +-
src/test/regress/expected/graph_table.out | 21 +++++++++++----------
src/test/regress/sql/graph_table.sql      |  5 +++--
3 files changed, 15 insertions(+), 13 deletions(-)

Reply via email to