pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedappend columns that are null
6+ messages / 3 participants
[nested] [flat]
* append columns that are null
@ 2004-07-07 15:01 Gerwin Philippo <gerwin@vernet.nl>
2004-07-07 15:25 ` Re: append columns that are null nobody <nobody@nowhere.near.here>
0 siblings, 1 reply; 6+ messages in thread
From: Gerwin Philippo @ 2004-07-07 15:01 UTC (permalink / raw)
To: pgsql-sql
I have function that appends 2 columns, like
"new.field1 = new.field2||new.field3",
but when field 3 is null, then the entire outcome is null, while I
expected just field2, since when I append nothing to field2, I get
field2, right?
Is this standard behaviour, and if so, is there another append function
that I can use that doesn't behave like this?
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: append columns that are null
2004-07-07 15:01 append columns that are null Gerwin Philippo <gerwin@vernet.nl>
@ 2004-07-07 15:25 ` nobody <nobody@nowhere.near.here>
2004-07-07 19:35 ` Re: append columns that are null Hans de Bruin <hans@nl.invalid>
2004-07-08 07:26 ` Re: append columns that are null Gerwin Philippo <gerwin@vernet.nl>
0 siblings, 2 replies; 6+ messages in thread
From: nobody @ 2004-07-07 15:25 UTC (permalink / raw)
To: pgsql-sql
"Gerwin Philippo" <gerwin@vernet.nl> wrote in message
news:40ec1043$0$559$e4fe514c@news.xs4all.nl...
> I have function that appends 2 columns, like
> "new.field1 = new.field2||new.field3",
> but when field 3 is null, then the entire outcome is null, while I
> expected just field2, since when I append nothing to field2, I get
> field2, right?
> Is this standard behaviour, and if so, is there another append function
> that I can use that doesn't behave like this?
COALESCE is your friend...
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: append columns that are null
2004-07-07 15:01 append columns that are null Gerwin Philippo <gerwin@vernet.nl>
2004-07-07 15:25 ` Re: append columns that are null nobody <nobody@nowhere.near.here>
@ 2004-07-07 19:35 ` Hans de Bruin <hans@nl.invalid>
1 sibling, 0 replies; 6+ messages in thread
From: Hans de Bruin @ 2004-07-07 19:35 UTC (permalink / raw)
To: pgsql-sql
nobody wrote:
> "Gerwin Philippo" <gerwin@vernet.nl> wrote in message
> news:40ec1043$0$559$e4fe514c@news.xs4all.nl...
>
>>I have function that appends 2 columns, like
>>"new.field1 = new.field2||new.field3",
>>but when field 3 is null, then the entire outcome is null, while I
>>expected just field2, since when I append nothing to field2, I get
>>field2, right?
>>Is this standard behaviour, and if so, is there another append function
>>that I can use that doesn't behave like this?
3 + unknown value = unknown value
its also unknown if 3 is bigger, smaller or equal to an unknown value.
--
Hans de Bruin
http://eratosthenes.xs4all.nl
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: append columns that are null
2004-07-07 15:01 append columns that are null Gerwin Philippo <gerwin@vernet.nl>
2004-07-07 15:25 ` Re: append columns that are null nobody <nobody@nowhere.near.here>
@ 2004-07-08 07:26 ` Gerwin Philippo <gerwin@vernet.nl>
2004-07-08 08:53 ` Re: append columns that are null nobody <nobody@nowhere.near.here>
1 sibling, 1 reply; 6+ messages in thread
From: Gerwin Philippo @ 2004-07-08 07:26 UTC (permalink / raw)
To: pgsql-sql
THX! didn't know that one yet :)
nobody wrote:
> "Gerwin Philippo" <gerwin@vernet.nl> wrote in message
> news:40ec1043$0$559$e4fe514c@news.xs4all.nl...
>
>>I have function that appends 2 columns, like
>>"new.field1 = new.field2||new.field3",
>>but when field 3 is null, then the entire outcome is null, while I
>>expected just field2, since when I append nothing to field2, I get
>>field2, right?
>>Is this standard behaviour, and if so, is there another append function
>>that I can use that doesn't behave like this?
>
>
> COALESCE is your friend...
>
>
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: append columns that are null
2004-07-07 15:01 append columns that are null Gerwin Philippo <gerwin@vernet.nl>
2004-07-07 15:25 ` Re: append columns that are null nobody <nobody@nowhere.near.here>
2004-07-08 07:26 ` Re: append columns that are null Gerwin Philippo <gerwin@vernet.nl>
@ 2004-07-08 08:53 ` nobody <nobody@nowhere.near.here>
2004-07-08 12:53 ` Re: append columns that are null Gerwin Philippo <gerwin@vernet.nl>
0 siblings, 1 reply; 6+ messages in thread
From: nobody @ 2004-07-08 08:53 UTC (permalink / raw)
To: pgsql-sql
You are welcome. Only if all problems were that simple ;-)...
"Gerwin Philippo" <gerwin@vernet.nl> wrote in message
news:40ecf718$0$36169$e4fe514c@news.xs4all.nl...
> THX! didn't know that one yet :)
>
> nobody wrote:
> > "Gerwin Philippo" <gerwin@vernet.nl> wrote in message
> > news:40ec1043$0$559$e4fe514c@news.xs4all.nl...
> >
> >>I have function that appends 2 columns, like
> >>"new.field1 = new.field2||new.field3",
> >>but when field 3 is null, then the entire outcome is null, while I
> >>expected just field2, since when I append nothing to field2, I get
> >>field2, right?
> >>Is this standard behaviour, and if so, is there another append function
> >>that I can use that doesn't behave like this?
> >
> >
> > COALESCE is your friend...
> >
> >
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: append columns that are null
2004-07-07 15:01 append columns that are null Gerwin Philippo <gerwin@vernet.nl>
2004-07-07 15:25 ` Re: append columns that are null nobody <nobody@nowhere.near.here>
2004-07-08 07:26 ` Re: append columns that are null Gerwin Philippo <gerwin@vernet.nl>
2004-07-08 08:53 ` Re: append columns that are null nobody <nobody@nowhere.near.here>
@ 2004-07-08 12:53 ` Gerwin Philippo <gerwin@vernet.nl>
0 siblings, 0 replies; 6+ messages in thread
From: Gerwin Philippo @ 2004-07-08 12:53 UTC (permalink / raw)
To: pgsql-sql
I'd be out of work very soon :(
nobody wrote:
> You are welcome. Only if all problems were that simple ;-)...
> "Gerwin Philippo" <gerwin@vernet.nl> wrote in message
> news:40ecf718$0$36169$e4fe514c@news.xs4all.nl...
>
>>THX! didn't know that one yet :)
>>
>>nobody wrote:
>>
>>>"Gerwin Philippo" <gerwin@vernet.nl> wrote in message
>>>news:40ec1043$0$559$e4fe514c@news.xs4all.nl...
>>>
>>>
>>>>I have function that appends 2 columns, like
>>>>"new.field1 = new.field2||new.field3",
>>>>but when field 3 is null, then the entire outcome is null, while I
>>>>expected just field2, since when I append nothing to field2, I get
>>>>field2, right?
>>>>Is this standard behaviour, and if so, is there another append function
>>>>that I can use that doesn't behave like this?
>>>
>>>
>>>COALESCE is your friend...
>>>
>>>
>
>
>
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2004-07-08 12:53 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-07-07 15:01 append columns that are null Gerwin Philippo <gerwin@vernet.nl>
2004-07-07 15:25 ` nobody <nobody@nowhere.near.here>
2004-07-07 19:35 ` Hans de Bruin <hans@nl.invalid>
2004-07-08 07:26 ` Gerwin Philippo <gerwin@vernet.nl>
2004-07-08 08:53 ` nobody <nobody@nowhere.near.here>
2004-07-08 12:53 ` Gerwin Philippo <gerwin@vernet.nl>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox