Re: time for catalog/pg_cast.c?

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: time for catalog/pg_cast.c?
Date: 2020-03-09 21:14:44
Message-ID: 20200309211444.GA24535@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2020-Mar-09, Alvaro Herrera wrote:

> I extracted from the latest multirange patch a bit that creates a new
> routine CastCreate() in src/backend/catalog/pg_cast.c. It contains the
> catalog-accessing bits to create a new cast. It seems harmless, so I
> thought I'd apply it to get rid of a couple of hunks in the large patch.

I forgot to "git add" this comment addition before sending:

/*
* ----------------------------------------------------------------
* CastCreate
*
* Forms and inserts catalog tuples for a new cast being created.
* Caller must have already checked privileges, and done consistency
* checks on the given datatypes and cast function (if applicable).
*
* 'behavior' indicates the dependency that the new cast will have on
* its input and output types and the cast function.
* ----------------------------------------------------------------
*/
ObjectAddress
CastCreate(Oid sourcetypeid, Oid targettypeid, Oid funcid, char castcontext,
char castmethod, DependencyType behavior)

I think the only API consideration here is for 'castcontext', which we
pass here as the pg_type.h symbol, but could alternatively be passed as
CoercionContext enum values (from primnodes.h). I think the pg_cast.h
char is okay, but maybe somebody has a different opinion.
We could also add some trivial asserts (like if procoid is not invalid,
then method is function, etc.), but it doesn't seem worth fussing too
much over.

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2020-03-09 21:21:13 Re: Support external parameters in EXECUTE command
Previous Message Alvaro Herrera 2020-03-09 21:00:03 time for catalog/pg_cast.c?