Re: why the need for is null?
От | Guy Fraser |
---|---|
Тема | Re: why the need for is null? |
Дата | |
Msg-id | 3FF5BAF3.1030405@incentre.net обсуждение исходный текст |
Ответ на | Re: why the need for is null? (Baldur Norddahl <bbn-pgsql.general@clansoft.dk>) |
Ответы |
Re: why the need for is null?
Re: why the need for is null? |
Список | pgsql-general |
Baldur Norddahl wrote: > Quoting Martijn van Oosterhout <kleptog@svana.org>: > ... >>You could create a new operator, but that means you'll have difficulty >>moving it to any database that doesn't have that operator (which is most of >>them). >> >> > >Any commercial database vendor would be happy to make such a feature just for >that reason: to lock me in to their database :-). I do not try to stay database >neutral, and use lots of other features that will only work in postgresql. > > There already is an operator, and it is the ANSI SQL operator "IS". Just because "IS" does not use puctuation characters does not mean it is not an operator. >>If you want it to match perhaps you should forget NULL and use '' (zero >>length string) instead. >> >> An empty string is an empty string, and a NULL is the lack of there being a string, they are not the same. If you want toemulate what you have proposed then use the function "coalesce". Example: select coalesce(string_column,'') from some_table ; This will return an empty string for all records that have no data in string_column. I have designed a number of realtime data collection programs, and when inserting only the available data into the propercolumns of the table, I often end up will "NULL" columns because there was no data for that column. It is very usefullto know if you had data available or if the data was 0 or an empty string. If you still don't understand, then use MySQL it is messed up and allows weird things like most of what you want to do. Happy New Year
В списке pgsql-general по дате отправления: