mirror of https://github.com/citusdata/citus.git
Fix deparsing FETCH FIRST <expr> ROWS WITH TIES
29f7ce6fe78e3f8d520764b5870453d791a3ca65m3hm3t/pg18_dev_relation_oid_0
parent
485feb6acc
commit
1d32b381ec
|
@ -2400,10 +2400,20 @@ get_select_query_def(Query *query, deparse_context *context)
|
||||||
{
|
{
|
||||||
if (query->limitOption == LIMIT_OPTION_WITH_TIES)
|
if (query->limitOption == LIMIT_OPTION_WITH_TIES)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* The limitCount arg is a c_expr, so it needs parens. Simple
|
||||||
|
* literals and function expressions would not need parens, but
|
||||||
|
* unfortunately it's hard to tell if the expression will be
|
||||||
|
* printed as a simple literal like 123 or as a typecast
|
||||||
|
* expression, like '-123'::int4. The grammar accepts the former
|
||||||
|
* without quoting, but not the latter.
|
||||||
|
*/
|
||||||
// had to add '(' and ')' here because it fails with casting
|
// had to add '(' and ')' here because it fails with casting
|
||||||
appendContextKeyword(context, " FETCH FIRST (",
|
appendContextKeyword(context, " FETCH FIRST (",
|
||||||
-PRETTYINDENT_STD, PRETTYINDENT_STD, 0);
|
-PRETTYINDENT_STD, PRETTYINDENT_STD, 0);
|
||||||
|
appendStringInfoChar(buf, '(');
|
||||||
get_rule_expr(query->limitCount, context, false);
|
get_rule_expr(query->limitCount, context, false);
|
||||||
|
appendStringInfoChar(buf, ')');
|
||||||
appendStringInfoString(buf, ") ROWS WITH TIES");
|
appendStringInfoString(buf, ") ROWS WITH TIES");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue