From: | "George Pavlov" <gpavlov(at)mynewplace(dot)com> |
---|---|
To: | <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: DISTINCT with NULLs and INT fields |
Date: | 2005-12-28 21:04:10 |
Message-ID: | CCB89282FCE1024EA3DCE687A96A5164039EC5FE@ehost010-6.exch010.intermedia.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
> Sure, but in this example the required type of the value is clear from
> immediate context (ie, the INSERT). This is one of the cases where
> the SQL spec requires a bare NULL to be accepted. (BTW, 'no' and '4'
> in this example are *not* values of type text; they are
> untyped literals which we eventually resolve as varchar or int.)
hmmm... with the risk of boring everyone to tears:
test=# insert into foo values (4::int,4::int);
INSERT 0 1
test=# insert into foo values (4::text,4::text);
ERROR: column "b" is of type integer but expression is of type text
HINT: You will need to rewrite or cast the expression.
test=# insert into foo values (cast(4 as int),cast(4 as int));
INSERT 0 1
test=# insert into foo values (cast(4 as text),cast(4 as text));
ERROR: column "b" is of type integer but expression is of type text
HINT: You will need to rewrite or cast the expression.
(i actually think it is important to understand how this stuff works and
thanks for explaining!)
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2005-12-28 21:24:02 | Re: DISTINCT with NULLs and INT fields |
Previous Message | Tom Lane | 2005-12-28 20:46:29 | Re: DISTINCT with NULLs and INT fields |