array_cat null reasoning

From: Kev <kevinjamesfield(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: array_cat null reasoning
Date: 2008-10-27 18:08:35
Message-ID: edc50847-3caa-419f-a0c1-d7e35a90f26f@75g2000hso.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I'm a bit confused as to the logic of nulls. I understand that null
is to represent an unknown value. So it makes sense that the result
of tacking an unknown value onto a known one is unknown, because you
don't know what exactly you just tacked on. So

select null::text || 'hello';

...returning NULL makes sense. But then why doesn't

select array_cat(null::integer[], '{3}'::integer[]);

...also return null? Somehow it's known what the result is when
combining an unknown array with a known one, but not when combining an
unknown text with a known one? Doesn't this seem inconsistent? If it
does seem inconsistent, should I be careful how to code because this
might change in the future?

Thanks,
Kev

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Anderson dos Santos Donda 2008-10-27 18:09:31 Execute Shell script after insert
Previous Message Simon Riggs 2008-10-27 17:16:11 Re: [HACKERS] Hot Standby utility and administrator functions