Re: IFNULL -> COALESCE
От | Stephan Szabo |
---|---|
Тема | Re: IFNULL -> COALESCE |
Дата | |
Msg-id | 20020208102617.Y44162-100000@megazone23.bigpanda.com обсуждение исходный текст |
Ответ на | Re: IFNULL -> COALESCE (Lee Kindness <lkindness@csl.co.uk>) |
Список | pgsql-hackers |
On Fri, 8 Feb 2002, Lee Kindness wrote: > Christopher Kings-Lynne writes: > > lkindness@csl.co.uk writes: > > > SELECT COALESCE(MAX(id), 0) + 1 from test; > > > can be replaced by the following PostgreSQL query: > > > SELECT COALESCE(MAX(id), 0) + 1 from test; > > Ummm...did you make a mistake here? Those statements are > > identical... > > Okay, lets try that again... > > SELECT IFNULL(MAX(id), 0) + 1 from test; > > can be replaced by the following PostgreSQL query: > > SELECT COALESCE(MAX(id), 0) + 1 from test; Might be nice to have it done automatically, but as a workaround why not just define ifnull(int, int) - or whatever types are necessary. create function ifnull(int, int) returns int as 'select coalesce($1, $2);' language 'sql'; should work for 7.1 and above unless I'm missing something.
В списке pgsql-hackers по дате отправления: