pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
A parsing question
3+ messages / 3 participants
[nested] [flat]

* A parsing question
@ 2020-06-03 22:41 Michael Nolan <htfoot@gmail.com>
  2020-06-03 22:54 ` Re: A parsing question David G. Johnston <david.g.johnston@gmail.com>
  2020-06-03 22:55 ` Re: A parsing question Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 2 replies; 3+ messages in thread

From: Michael Nolan @ 2020-06-03 22:41 UTC (permalink / raw)
  To: pgsql-general

Recently I was typing in a query in PG 10.4.

What I MEANT to type was:   Where xyz >= 2400

What I actually typed was:  Where xyz >- 2400

The latter was interpreted as 'where xyz > -2400', but I'm wondering if it
shouldn't have thrown an error on an unrecognized operator '>-'

Thoughts?
--
Mike Nolan
htfoot@gmail.com

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: A parsing question
  2020-06-03 22:41 A parsing question Michael Nolan <htfoot@gmail.com>
@ 2020-06-03 22:54 ` David G. Johnston <david.g.johnston@gmail.com>
  1 sibling, 0 replies; 3+ messages in thread

From: David G. Johnston @ 2020-06-03 22:54 UTC (permalink / raw)
  To: Michael Nolan <htfoot@gmail.com>; +Cc: pgsql-general

On Wed, Jun 3, 2020 at 3:41 PM Michael Nolan <htfoot@gmail.com> wrote:

> Recently I was typing in a query in PG 10.4.
>
> What I MEANT to type was:   Where xyz >= 2400
>
> What I actually typed was:  Where xyz >- 2400
>
> The latter was interpreted as 'where xyz > -2400', but I'm wondering if it
> shouldn't have thrown an error on an unrecognized operator '>-'
>

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: A parsing question
  2020-06-03 22:41 A parsing question Michael Nolan <htfoot@gmail.com>
@ 2020-06-03 22:55 ` Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 0 replies; 3+ messages in thread

From: Tom Lane @ 2020-06-03 22:55 UTC (permalink / raw)
  To: Michael Nolan <htfoot@gmail.com>; +Cc: pgsql-general

Michael Nolan <htfoot@gmail.com> writes:
> Recently I was typing in a query in PG 10.4.
> What I MEANT to type was:   Where xyz >= 2400

> What I actually typed was:  Where xyz >- 2400

> The latter was interpreted as 'where xyz > -2400', but I'm wondering if it
> shouldn't have thrown an error on an unrecognized operator '>-'

No, we do it that way intentionally, because the SQL standard requires us
to parse such cases in this way.  The CREATE OPERATOR man page has some
details about what is and isn't a valid operator name ... and '>-' isn't
one.  (The rules there probably look a bit bizarre, but the intention
is to ensure that operators found in the SQL spec can be parsed without
requiring spaces between them.)

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2020-06-03 22:55 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-06-03 22:41 A parsing question Michael Nolan <htfoot@gmail.com>
2020-06-03 22:54 ` David G. Johnston <david.g.johnston@gmail.com>
2020-06-03 22:55 ` Tom Lane <tgl@sss.pgh.pa.us>

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