Re: A proper fix for the conversion-function problem

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: A proper fix for the conversion-function problem
Date: 2005-05-04 02:29:05
Message-ID: 13765.1115173745@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp> writes:
>> Going forward, though, I really think we need to revisit the API
>> for conversion functions. It seems a bit silly to have the
>> infrastructure to let ordinary users create conversions if they
>> can't create the functions needed to support them.

> Why? Since the functions need to be written in C language, ordinary
> users cannot make them anyway. Same thing can be said to CREATE TYPE.

Isn't that a circular argument? If the API were not deliberately
designed to make it C-only, you could usefully code conversions in
string-hacking-friendly languages like Perl.

I'd really like to simplify the conversion function signature to
something like
convert(bytea) returns bytea
or possibly
convert(cstring) returns cstring
depending on whether you think that it's important to be able to pass
zero bytes transparently. (The current encoding infrastructure seems
pretty confused about that point --- there are null-terminated strings
in some places and counts in others. Are there any encodings we care
about that require embedded zero bytes?)

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Mischa Sandberg 2005-05-04 02:52:16 Re: [PERFORM] Bad n_distinct estimation; hacks suggested?
Previous Message Jim C. Nasby 2005-05-04 02:19:15 Re: pg_locks needs a facelift