From: Tom Lane <tgl@sss.pgh.pa.us>
To: Thiemo Kellner <thiemo@gelassene-pferde.biz>
Cc: PostgreSQL General <pgsql-general@lists.postgresql.org>
Subject: Re: I do not get the point of the information_schema
Date: Mon, 12 Feb 2018 17:23:14 -0500
Message-ID: <18156.1518474194@sss.pgh.pa.us> (raw)
In-Reply-To: <303d3d2c-ef0b-af0a-e4d1-4b17a029fc0f@gelassene-pferde.biz>
References: <303d3d2c-ef0b-af0a-e4d1-4b17a029fc0f@gelassene-pferde.biz>
Thiemo Kellner <thiemo@gelassene-pferde.biz> writes:
> I try to implement SCD2 on trigger level and try to generated needed
> code on the fly. Therefore I need to read data about the objects in the
> database. So far so good. I know of the information_schema and the
> pg_catalog. The documentation for the information_schema states that it
> 'is defined in the SQL standard and can therefore be expected to be
> portable and remain stable'. I can think of a sensible meaning of
> portable. One cannot port it to MariaDB, can one?
If MariaDB implements information_schema according to the spec, then
yes. (If they don't, that's something to complain about to them,
not us.)
> I created following query to get
> the index columns of an index. I fear breakage when not run on the
> specific version I developed it against. Is there a more elegant way by
> the information_schema?
No, because indexes are not a part of the SQL standard. (I'm not here
to debate the wisdom of that choice; we didn't make it.) You can get
information about constraints out of the information_schema, so to the
extent that what you're interested in is the indexes underlying PK or
UNIQUE constraints, that's an option. Otherwise, you're dealing with an
implementation-specific feature and you shouldn't be surprised that the
way of finding out about it is likewise implementation-specific.
FWIW, the stuff used in your sample query has all been there for a
very long time; we don't like to break plausible client queries lightly.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, thiemo@gelassene-pferde.biz
Subject: Re: I do not get the point of the information_schema
In-Reply-To: <18156.1518474194@sss.pgh.pa.us>
References: <303d3d2c-ef0b-af0a-e4d1-4b17a029fc0f@gelassene-pferde.biz> <18156.1518474194@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox