pg.ddx.io pgsql-docs@postgresql.org mailing list archive
help / color / mirror / Atom feedExcept does not work as in the documentation
2+ messages / 2 participants
[nested] [flat]
* Except does not work as in the documentation
@ 2025-02-25 17:37 PG Doc comments form <noreply@postgresql.org>
2025-02-25 21:22 ` Re: Except does not work as in the documentation Greg Sabino Mullane <htamfids@gmail.com>
0 siblings, 1 reply; 2+ messages in thread
From: PG Doc comments form @ 2025-02-25 17:37 UTC (permalink / raw)
To: pgsql-docs@lists.postgresql.org; +Cc: makams@labcorp.com
The following documentation comment has been logged on the website:
Page: https://www.postgresql.org/docs/17/queries-union.html
Description:
The current documentation does not give the right syntax for using the
EXCEPT in a query.
This is the error when I ran the below:
select appt_id from wayfinder.patient_details where create_timestamp between
('2025-02-24 00:00:00' and '2025-02-25 00:00:00')
EXCEPT
select appt_id from wayfinder.appointment_details where create_timestamp
between ('2025-02-24 00:00:00' and '2025-02-25 00:00:00')
ERROR: syntax error at or near "EXCEPT"
LINE 2: EXCEPT
^
SQL state: 42601
Character: 128
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Except does not work as in the documentation
2025-02-25 17:37 Except does not work as in the documentation PG Doc comments form <noreply@postgresql.org>
@ 2025-02-25 21:22 ` Greg Sabino Mullane <htamfids@gmail.com>
0 siblings, 0 replies; 2+ messages in thread
From: Greg Sabino Mullane @ 2025-02-25 21:22 UTC (permalink / raw)
To: makams@labcorp.com; pgsql-docs@lists.postgresql.org
Your BETWEEN statement has X AND Y inside of parenthesis. No parenthesis
are needed, the format is:
BETWEEN X AND Y
not
BETWEEN (X AND Y)
See:
https://www.postgresql.org/docs/current/functions-comparison.html
Postgres is complaining about the EXCEPT because it is waiting for the next
item in the BETWEEN clause. It just happened to be in the line of fire -
any other word would have triggered an error as well.
Cheers,
Greg
--
Crunchy Data - https://www.crunchydata.com
Enterprise Postgres Software Products & Tech Support
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2025-02-25 21:22 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-02-25 17:37 Except does not work as in the documentation PG Doc comments form <noreply@postgresql.org>
2025-02-25 21:22 ` Greg Sabino Mullane <htamfids@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox