Re: SQL99, CREATE CAST, and initdb

From: Thomas Lockhart <lockhart(at)fourpalms(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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 14:58:49
Message-ID: 3D188529.A61EB50@fourpalms.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> 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

I'll bet that is it, though possible differences in CAST() behaviors are
not explained. I'll see if I can reproduce them...

> 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.

Well, istm that we should choose something different. The example I was
using might be a good use case for a situation we should handle: I
implemented a function to convert Unix system time to PG timestamp, and
wanted it to respond to an explicit cast but *not* an implicit cast.

I got it to work at some point (not sure how, given your description of
the schema, uh, scheme) but istm that we definitely do not want to
*require* modifications to pg_catalog for any and every change in
feature or behavior for built-in types. The schema settings are
important, and should have some influence over behavior; that is, if
someone extends PG in one schema then if that schema is in the chain it
should be able to influence the session, and if it is not then it should
only be able to influence the session if there are side-effects from
previous definitions.

btw, how *do* I control the default schema? Is it always the schema at
the front of the search list, or are there other more direct knobs to
help determine this other than explicitly qualifying names in queries?

- Thomas

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2002-06-25 15:00:19 Re: Buffer Management
Previous Message Bruce Momjian 2002-06-25 14:56:58 Re: Buffer Management