pg.ddx.io pgsql-interfaces@postgresql.org mailing list archivehelp / color / mirror / Atom feed
ecpg: arrays and nulls 3+ messages / 2 participants [nested] [flat]
* ecpg: arrays and nulls @ 2005-08-02 08:40 Kuba Ouhrabka <kuba@comgate.cz> 2005-08-23 09:53 ` Re: ecpg: arrays and nulls Michael Meskes <meskes@postgresql.org> 0 siblings, 1 reply; 3+ messages in thread From: Kuba Ouhrabka @ 2005-08-02 08:40 UTC (permalink / raw) To: pgsql-interfaces Hi, 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 ... I'm using indicators and I use char * variables for array values (for all column types: int[], text[], bytea[]). It works when the value of array is not null but when it's null I get the error above. Can null values in columns of array type be handled in more convenient way than using coalesce/nullif and special reserved value? Thanks, Kuba ^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: ecpg: arrays and nulls 2005-08-02 08:40 ecpg: arrays and nulls Kuba Ouhrabka <kuba@comgate.cz> @ 2005-08-23 09:53 ` Michael Meskes <meskes@postgresql.org> 2005-08-29 08:45 ` Re: ecpg: arrays and nulls Kuba Ouhrabka <kuba@comgate.cz> 0 siblings, 1 reply; 3+ messages in thread From: Michael Meskes @ 2005-08-23 09:53 UTC (permalink / raw) To: Kuba Ouhrabka <kuba@comgate.cz>; +Cc: pgsql-interfaces 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. > 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. Michael -- Michael Meskes Email: Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org) ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL! ^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: ecpg: arrays and nulls 2005-08-02 08:40 ecpg: arrays and nulls Kuba Ouhrabka <kuba@comgate.cz> 2005-08-23 09:53 ` Re: ecpg: arrays and nulls Michael Meskes <meskes@postgresql.org> @ 2005-08-29 08:45 ` Kuba Ouhrabka <kuba@comgate.cz> 0 siblings, 0 replies; 3+ messages in thread From: Kuba Ouhrabka @ 2005-08-29 08:45 UTC (permalink / raw) To: Michael Meskes <meskes@postgresql.org>; +Cc: 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 ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2005-08-29 08:45 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2005-08-02 08:40 ecpg: arrays and nulls Kuba Ouhrabka <kuba@comgate.cz> 2005-08-23 09:53 ` Michael Meskes <meskes@postgresql.org> 2005-08-29 08:45 ` Kuba Ouhrabka <kuba@comgate.cz>
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