Skip site navigation (1) Skip section navigation (2)

Re: charin(), text_char() should return something else for empty input

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: charin(), text_char() should return something else for empty input
Date: 2001-05-28 18:37:32
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
I wrote:
> I propose that both of these operations should return a space character
> for an empty input string.  This is by analogy to space-padding as you'd
> get with char(1).  Any objections?

An alternative approach is to make charin and text_char map empty
strings to the null character (\0), and conversely make charout and
char_text map the null character to empty strings.  charout already
acts that way, in effect, since it has to produce a null-terminated
C string.  This way would have the advantage that there would still
be a reversible dump and reload representation for a "char" field
containing '\0', whereas space-padding would cause such a field to
become ' ' after reload.  But it's a little strange if you think that
"char" ought to behave the same as char(1).


			regards, tom lane

In response to


pgsql-hackers by date

Next:From: D'Arcy J.M. CainDate: 2001-05-28 19:06:07
Subject: Re: User functions and AIX
Previous:From: Bruce MomjianDate: 2001-05-28 18:21:35
Subject: Re: doc markup bug....

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group