Re: maybe a bug in plpgsql, nulls and empty strings are not the same

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Domingo Alvarez Duarte <domingo(at)dad-it(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: maybe a bug in plpgsql, nulls and empty strings are not the same
Date: 2001-05-28 16:02:48
Message-ID: 13013.991065768@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Domingo Alvarez Duarte <domingo(at)dad-it(dot)com> writes:
> When trying write a function in plpgsql I'm getting behavior that
> probably isn't the corect one.

It works as expected if you declare v_sep as varchar rather than char.

I think plpgsql may be interpreting
v_sep char;
as declaring v_sep to be the internal 1-byte "char" type, not char(n)
with unspecified length as you are expecting. There's definitely
something strange going on with the assignment
v_sep := '''';

In any case it's a tad bizarre to use char rather than varchar for
something that you intend to have varying width, no?

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2001-05-28 16:06:16 Re: New/old style trigger API
Previous Message D'Arcy J.M. Cain 2001-05-28 15:56:17 User functions and AIX