Re: ecpg: arrays and nulls

From: Kuba Ouhrabka <kuba(at)comgate(dot)cz>
To: Michael Meskes <meskes(at)postgresql(dot)org>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: ecpg: arrays and nulls
Date: 2005-08-29 08:45:16
Message-ID: 4312CB1C.30600@comgate.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Hi,

Michael Meskes napsal(a):
> On Tue, Aug 02, 2005 at 10:40:23AM +0200, Kuba Ouhrabka wrote:
>
>>I'd like to ask how to handle null values when fetching arrays into
>>ecpg. Always I get this error:
>>
>>Data read from backend is not an array in line ...
>
> Found it. The check for array data was doen too early. Of course a
> NULL does not look like an array, so the message was issued before the
> data was tested on NULL values. I changed the order and it appears to be
> fine now. Expect a commit as soon as I am online again.

thanks.

>>Can null values in columns of array type be handled in more convenient
>>way than using coalesce/nullif and special reserved value?
>
> Not sure what you mean with this? Do you want an integer array like
> this {1,2,3,NULL,4,5}? I don't see how this could be possible as the
> array itself is the value of the column. You can of course use a
> relation instead of an array. In first normalform this should be easy to
> do.

Sorry, I meant I was using coalesce/nullif as a workaround for the bug
above.

Thanks again,

Kuba

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message Silvio Macedo 2005-08-29 18:43:05 COPY FROM STDIN fails inside Pl/pgSQL function or in PgAdmin , but ok in psql
Previous Message Michael Meskes 2005-08-26 13:09:11 Re: [HACKERS] ECPG ignores SAVEPOINT if first statement of a transaction