Re: SQL99, CREATE CAST, and initdb

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thomas Lockhart <lockhart(at)fourpalms(dot)org>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, PostgreSQL Hackers List <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: SQL99, CREATE CAST, and initdb
Date: 2002-06-25 00:55:24
Message-ID: 3206.1024966524@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I said:
> Thomas Lockhart <lockhart(at)fourpalms(dot)org> writes:
>> I've got another issue with casting which I've run into while testing
>> this feature; afaict invoking an explicit CAST() in SQL does not
>> guarantee that the function of the expected name would be called, if
>> that function does not have the implicit flag set.

> [ scratches head ] Whether the flag is set or not shouldn't matter;
> if the cast function is needed it will be called. Were you perhaps
> testing binary-compatible cases?

Another possibility is that you got burnt by some schema-related issue;
cf the updated conversion docs at
http://developer.postgresql.org/docs/postgres/typeconv-func.html

IIRC, a function is only considered to be a cast function if it matches
by name *and schema* with the target type. So if you, for example,
make a function public.int4(something), it'll never be considered a
cast function for pg_catalog.int4. I had some doubts about that rule
when I put it in, but so far have not thought of an alternative I like
better.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Rod Taylor 2002-06-25 02:16:21 Re: Nonrecursive ALTER TABLE ADD/RENAME COLUMN is wrong
Previous Message Tom Lane 2002-06-25 00:45:14 Re: SQL99, CREATE CAST, and initdb