Re: Do we need use more meaningful variables to replace 0 in catalog head files?

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Magnus Hagander <magnus(at)hagander(dot)net>, Jan de Visser <jan(at)de-visser(dot)net>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Hao Lee <mixtrue(at)gmail(dot)com>, Amit Langote <amitlangote09(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>
Subject: Re: Do we need use more meaningful variables to replace 0 in catalog head files?
Date: 2016-11-13 17:10:17
Message-ID: 20161113171017.7sgaqdeq6jslmsr3@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2016-11-13 11:11:37 -0500, Tom Lane wrote:
> 1. Are we going to try to keep these things in the .h files, or split
> them out? I'd like to get them out, as that eliminates both the need
> to keep the things looking like macro calls, and the need for the data
> within the macro call to be at least minimally parsable as C.

I vote for splitting them out.

> 2. Andrew's example above implies some sort of mapping between the
> keywords and the actual column names (or at least column positions).
> Where and how is that specified?

I don't know what andrew was planning, but before I stopped I had a 1:1
mapping beteween column names and keywords. Catalog.pm parses the
pg_*.h headers and thus knows the table definition via the CATALOG()
stuff.

> 3. Also where are we going to provide the per-column default values?

That's a good question, I suspect we should move that knowledge to the
headers as well. Possibly using something like BKI_DEFAULT(...)?

> How does the converter script know which columns to convert to type oids,
> proc oids, etc?

I simply had that based on the underlying reg* type. I.e. if a column
was regtype the script would map it to type oids and so on. That
required some type changes, which does have some compatibility concerns.

> Is it going to do any data validation beyond that, and if so on what basis?

Hm, not sure if we really need something.

> 4. What will we do about the #define's that some of the .h files provide
> for (some of) their object OIDs? I assume that we want to move in the
> direction of autogenerating those macros a la fmgroids.h, but this needs
> a concrete spec as well.

I suspect at least type oids we'll continue to have to maintain
manually. A good number of things rely on the builtin type oids being
essentially stable.

> > If we can generalize this to other catalogs, then that will be good, but
> > my inclination is to handle the elephant in the room (pg_proc.h) and
> > worry about the gnats later.
>
> I think we want to do them all.

+1

Greetings,

Andres Freund

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2016-11-13 17:11:36 Re: Do we need use more meaningful variables to replace 0 in catalog head files?
Previous Message Tom Lane 2016-11-13 16:23:09 Re: Do we need use more meaningful variables to replace 0 in catalog head files?