From: David Sauer <davids@orfinet.cz>
To: Glenn Waldron <gwaldron@wareonearth.com>
Cc: pgsql-sql@postgresql.org
Cc: pgsql-hackers@postgresql.org
Subject: bug report on text text fields. WAS: Re: [SQL] Trouble with ...
Date: 13 Apr 1999 18:16:53 +0200
Message-ID: <m2yajwsdfu.fsf@orfinet.cz> (raw)
References: <004401be85c1$e21175d0$0800a8c0@glenn.kivex.com>
>>>> "Glenn" == Glenn Waldron <gwaldron@wareonearth.com> writes:
Glenn> Using Postgres 6.5 beta (snap 12 apr), on Linux i386. I moved up from
Glenn> 6.4.2 when I couldn't get things working.
Glenn> I'm having difficulty dealing with null text/varchar fields. I need
Glenn> to be able to interpret null values as the null string '' for the
Glenn> purposes on concatenation.
Glenn> 1) ----
Glenn> For example, the query:
Glenn> SELECT (field_one || field_two) from t1;
Glenn> Will return the concatenation of the two fields. If either of the fields
Glenn> is null, it is interpreted as the empty string '' and the correct answer
Glenn> is printed.
Correct ?
I have a table:
david=> \d t
Table = t
+----------------------------------+----------------------------------+-------+| Field | Type | Length|+----------------------------------+----------------------------------+-------+| a | text | var || b | text | var |+----------------------------------+----------------------------------+-------+
david=> insert into t values (NULL, '1111');
INSERT 26656 1
david=> insert into t values ('2222', NULL);
INSERT 26657 1
david=> select a||b from t;
?column?
--------
(2 rows)
But I expect something like:
1111
2222
not 2 empty strings. It is wrong ?
================================================
And yet, I found bug in cast. Try on table above:
select a::int from t;
... this will crash backend on field with NULL value ....
I have postgres 6.5beta1 compiled by egcs-1.1.2 on linux box with
IBM 6x86L processor ...
--
* David Sauer, student of Czech Technical University
* electronic mail: davids@orfinet.cz (mime compatible)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: davids@orfinet.cz, gwaldron@wareonearth.com, pgsql-hackers@postgresql.org
Subject: Re: bug report on text text fields. WAS: Re: [SQL] Trouble with ...
In-Reply-To: <m2yajwsdfu.fsf@orfinet.cz>
References: <004401be85c1$e21175d0$0800a8c0@glenn.kivex.com> <m2yajwsdfu.fsf@orfinet.cz>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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