Re: DISTINCT with NULLs and INT fields
| От | George Pavlov |
|---|---|
| Тема | Re: DISTINCT with NULLs and INT fields |
| Дата | |
| Msg-id | CCB89282FCE1024EA3DCE687A96A5164039EC5FE@ehost010-6.exch010.intermedia.net обсуждение исходный текст |
| Ответ на | DISTINCT with NULLs and INT fields ("George Pavlov" <gpavlov@mynewplace.com>) |
| Ответы |
Re: DISTINCT with NULLs and INT fields
|
| Список | 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!)
В списке pgsql-sql по дате отправления: