Re: BUG #18929: After the view is created, executed query against the view definition, reported syntax error.
Heikki Linnakangas <hlinnaka@iki.fi>
From: Heikki Linnakangas <hlinnaka@iki.fi>
To: 707330139@qq.com, pgsql-bugs@lists.postgresql.org
Date: 2025-05-19T15:52:50Z
Lists: pgsql-bugs
On 15/05/2025 17:41, Heikki Linnakangas wrote: > On 15/05/2025 07:04, PG Bug reporting form wrote: >> postgres=# \d+ limit_thousand_v_3 >> View "public.limit_thousand_v_3" >> Column | Type | Collation | Nullable | Default | Storage | >> Description >> ----------+---------+-----------+----------+---------+--------- >> +------------- >> thousand | integer | | | | plain | >> View definition: >> SELECT thousand >> FROM onek >> WHERE thousand < 995 >> ORDER BY thousand >> FETCH FIRST NULL::bigint + 1::bigint ROWS WITH TIES; >> postgres=# SELECT thousand >> postgres-# FROM onek >> postgres-# WHERE thousand < 995 >> postgres-# ORDER BY thousand >> postgres-# FETCH FIRST NULL::bigint + 1::bigint ROWS WITH TIES; >> ERROR: syntax error at or near "::" >> LINE 5: FETCH FIRST NULL::bigint + 1::bigint ROWS WITH TIES; >> ^ > > Agreed that's a bug. Attached is a simple patch to add parens to all > deparsed FETCH FIRST n ROWS WITH TIES expressions. > > It would be nice to skip the parens for simple literals, but > unfortunately it's non-trivial to distinguish Consts that are printed as > simple literals from more complicated cases that are printed as > typecasts, like '123'::bigint. XMLEXISTS is another expression type that > takes a 'c_expr' in the the grammar, and it also just always adds the > parens. > > I'll commit this fix, unless someone comes up with something more > sophisticated. Committed, thanks for the report. -- Heikki Linnakangas Neon (https://neon.tech)
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Fix cross-version upgrade test failure
- 558ea446aeb0 16.10 landed
- a4da7b0cfabd 17.6 landed
- cbf53e2b8a8e 18.0 landed
-
Fix deparsing FETCH FIRST <expr> ROWS WITH TIES
- 0420b24fee5e 14.19 landed
- 72fe74ca5333 15.14 landed
- 92a9ba3b96c2 16.10 landed
- 54c05292b1ff 17.6 landed
- 29f7ce6fe78e 18.0 landed
- 7ee00918f7cd 13.22 landed