From: Peter J. Holzer <hjp-pgsql@hjp.at>
To: pgsql-general@lists.postgresql.org
Subject: Re: I do not get the point of the information_schema
Date: Tue, 13 Feb 2018 23:57:55 +0100
Message-ID: <20180213225755.hbpadizwav3ma2kn@hjp.at> (raw)
In-Reply-To: <303d3d2c-ef0b-af0a-e4d1-4b17a029fc0f@gelassene-pferde.biz>
References: <303d3d2c-ef0b-af0a-e4d1-4b17a029fc0f@gelassene-pferde.biz>
On 2018-02-12 23:01:41 +0100, Thiemo Kellner wrote:
> 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?
You don't port the information schema to MariaDB. The information schema
is provided by the database.
The *use* of the information schema is portable between standard-
conforming databases, however.
You can use
select table_schema, table_name
from information_schema.tables
where table_type='BASE TABLE';
on both PostgreSQL and MariaDB to get a list of tables.
(That said, it looks like both PostgreSQL and MariaDB include additional
columns beyond those mandated by the standard - you can't rely on those,
of course. And some databases like Oracle don't even have an information
schema.)
hp
--
_ | Peter J. Holzer | we build much bigger, better disasters now
|_|_) | | because we have much more sophisticated
| | | hjp@hjp.at | management tools.
__/ | http://www.hjp.at/ | -- Ross Anderson <https://www.edge.org/;
Attachments:
signature.asc (application/pgp-signature, 832B) download
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: hjp-pgsql@hjp.at
Subject: Re: I do not get the point of the information_schema
In-Reply-To: <20180213225755.hbpadizwav3ma2kn@hjp.at>
References: <303d3d2c-ef0b-af0a-e4d1-4b17a029fc0f@gelassene-pferde.biz> <20180213225755.hbpadizwav3ma2kn@hjp.at>
* 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