Re: input/output functions have been changed ? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: input/output functions have been changed ?
Date
Msg-id 17184.961040565@sss.pgh.pa.us
Whole thread Raw
In response to input/output functions have been changed ?  ("Hiroshi Inoue" <Inoue@tpf.co.jp>)
Responses RE: input/output functions have been changed ?
List pgsql-hackers
"Hiroshi Inoue" <Inoue@tpf.co.jp> writes:
> I just want to confirm if input/output functions have 
> been changed.

> select int4out(1);
>    int4out
> -----------
>   136475032
> (1 row)

Sure, you expected something nicer?  You're seeing the numeric
representation of a C string pointer.

Actually, checking 6.5, I see that int4out --- alone of all the *out
functions --- used to be declared in pg_proc to return type 'name'.
All the other ones are declared to return type 'int4', which means if
you invoke them explicitly as in the above example, you'll see the
numeric equivalent of whatever pointer value they return.

'name' is not a correct declaration either since it implies a string
of < NAMEDATALEN chars, but it would have happened to produce the right
sort of results.

I changed int4out to be the same as the other *out functions recently,
just for consistency's sake.  Really the right fix is to assign a real
type OID to represent "C string" so that the argument and return types
of input/output functions can be declared honestly.  We've talked about
that before, and I've been thinking about making a concrete proposal
for it, but haven't done anything yet...
        regards, tom lane


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Big 7.1 open items
Next
From: "Hiroshi Inoue"
Date:
Subject: RE: input/output functions have been changed ?