Spec on pg_cast table/CREATE CAST command - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Spec on pg_cast table/CREATE CAST command
Date
Msg-id Pine.LNX.4.44.0207152143170.2259-100000@localhost.localdomain
Whole thread Raw
Responses Re: Spec on pg_cast table/CREATE CAST command
List pgsql-hackers
Command syntax is
 CREATE CAST (source AS target) WITH FUNCTION name(arg) [AS ASSIGNMENT]

in compliance with SQL99 (AS ASSIGNMENT means implicitly invokable).

Declaration of binary compatible casts:
 CREATE CAST (source AS target) WITHOUT FUNCTION [AS ASSIGNMENT]

Does not have to be implicit (although it must be for use in function
argument resultion, etc.).  You must declare both directions explicitly.

Cast functions must be immutable.  This is following SQL99 as well.

Compatibility:

The old way to create casts has already been broken in 1.5 ways: the
introduction of the implicit flag and the introduction of schemas.  To
maintain full compatibility we'd have to revert to making the implicit
flag the default, which would undermine the compliance of the new CREATE
CAST command from the start.

Hence I suggest that we migrate through pg_dump: User-defined functions
that would have been casts up to 7.2 will emit an appropriate CREATE CAST
command.  This in combination with a release note will also give the users
a better chance to inspect the dump and adjust the cast specifications for
implicitness as they wish.

Comments?

-- 
Peter Eisentraut   peter_e@gmx.net



pgsql-hackers by date:

Previous
From: Hannu Krosing
Date:
Subject: Re: DROP COLUMN
Next
From: Bruce Momjian
Date:
Subject: Re: BlockNumber fixes