Lists: | pgsql-hackers |
---|
From: | "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | "PostgreSQL-development Hackers" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | strange behaviour of parser - numeric domain doesn't work phantom |
Date: | 2007-08-13 07:51:46 |
Message-ID: | 162867790708130051i519bb900r36ff9bea632fa581@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Hello
I am testing:
postgres=# create domain nb int check(value > 10);
CREATE DOMAIN
postgres=# select 11::nb;
nb
----
11
(1 row) -- ok
postgres=# select -11::nb;
?column?
----------
-11
(1 row) -- ughh
postgres=# select (-11)::nb; -- I understand
ERROR: value for domain nb violates check constraint "nb_check"
But nobody will write parentheses with alone negative number
Regards
Pavel Stehule
postgres=# select version();
version
-------------------------------------------------------------------------------------------------------
PostgreSQL 8.3devel on i686-pc-linux-gnu, compiled by GCC gcc (GCC)
4.1.2 20070502 (Red Hat 4.1.2-12)
(1 row)
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com> |
Cc: | "PostgreSQL-development Hackers" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: strange behaviour of parser - numeric domain doesn't work phantom |
Date: | 2007-08-13 13:34:07 |
Message-ID: | 4526.1187012047@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
"Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com> writes:
> postgres=# select -11::nb;
The operator precedence table at
http://developer.postgresql.org/pgdocs/postgres/sql-syntax-lexical.html#SQL-PRECEDENCE
says perfectly clearly that :: binds more tightly than -.
regards, tom lane
From: | "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | "PostgreSQL-development Hackers" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: strange behaviour of parser - numeric domain doesn't work phantom |
Date: | 2007-08-13 14:55:31 |
Message-ID: | 162867790708130755w6c478504q7852c01d8f10b960@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
2007/8/13, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com> writes:
> > postgres=# select -11::nb;
>
> The operator precedence table at
> http://developer.postgresql.org/pgdocs/postgres/sql-syntax-lexical.html#SQL-PRECEDENCE
> says perfectly clearly that :: binds more tightly than -.
>
> regards, tom lane
>
My mistake. Sorry for noise
regards
Pavel Stehule