Lists: | pgsql-sql |
---|
From: | Gerwin Philippo <gerwin(at)vernet(dot)nl> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | append columns that are null |
Date: | 2004-07-07 15:01:22 |
Message-ID: | 40ec1043$0$559$e4fe514c@news.xs4all.nl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | 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?
From: | "nobody" <nobody(at)nowhere(dot)near(dot)here> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: append columns that are null |
Date: | 2004-07-07 15:25:32 |
Message-ID: | cch4kt$1i5s$1@news.hub.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-sql |
"Gerwin Philippo" <gerwin(at)vernet(dot)nl> wrote in message
news:40ec1043$0$559$e4fe514c(at)news(dot)xs4all(dot)nl(dot)(dot)(dot)
> 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...
From: | Hans de Bruin <hans(at)nl(dot)invalid> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: append columns that are null |
Date: | 2004-07-07 19:35:16 |
Message-ID: | 40ec5075$0$34762$e4fe514c@news.xs4all.nl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-sql |
nobody wrote:
> "Gerwin Philippo" <gerwin(at)vernet(dot)nl> wrote in message
> news:40ec1043$0$559$e4fe514c(at)news(dot)xs4all(dot)nl(dot)(dot)(dot)
>
>>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
From: | Gerwin Philippo <gerwin(at)vernet(dot)nl> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: append columns that are null |
Date: | 2004-07-08 07:26:15 |
Message-ID: | 40ecf718$0$36169$e4fe514c@news.xs4all.nl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-sql |
THX! didn't know that one yet :)
nobody wrote:
> "Gerwin Philippo" <gerwin(at)vernet(dot)nl> wrote in message
> news:40ec1043$0$559$e4fe514c(at)news(dot)xs4all(dot)nl(dot)(dot)(dot)
>
>>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...
>
>
From: | "nobody" <nobody(at)nowhere(dot)near(dot)here> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: append columns that are null |
Date: | 2004-07-08 08:53:41 |
Message-ID: | ccj224$1jq7$1@news.hub.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-sql |
You are welcome. Only if all problems were that simple ;-)...
"Gerwin Philippo" <gerwin(at)vernet(dot)nl> wrote in message
news:40ecf718$0$36169$e4fe514c(at)news(dot)xs4all(dot)nl(dot)(dot)(dot)
> THX! didn't know that one yet :)
>
> nobody wrote:
> > "Gerwin Philippo" <gerwin(at)vernet(dot)nl> wrote in message
> > news:40ec1043$0$559$e4fe514c(at)news(dot)xs4all(dot)nl(dot)(dot)(dot)
> >
> >>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...
> >
> >
From: | Gerwin Philippo <gerwin(at)vernet(dot)nl> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: append columns that are null |
Date: | 2004-07-08 12:53:29 |
Message-ID: | 40ed43c9$0$559$e4fe514c@news.xs4all.nl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | 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(at)vernet(dot)nl> wrote in message
> news:40ecf718$0$36169$e4fe514c(at)news(dot)xs4all(dot)nl(dot)(dot)(dot)
>
>>THX! didn't know that one yet :)
>>
>>nobody wrote:
>>
>>>"Gerwin Philippo" <gerwin(at)vernet(dot)nl> wrote in message
>>>news:40ec1043$0$559$e4fe514c(at)news(dot)xs4all(dot)nl(dot)(dot)(dot)
>>>
>>>
>>>>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...
>>>
>>>
>
>
>