Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1elMVe-00067X-4h for pgsql-general@arkaria.postgresql.org; Mon, 12 Feb 2018 22:23:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1elMVc-0002vn-L2 for pgsql-general@arkaria.postgresql.org; Mon, 12 Feb 2018 22:23:36 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1elMVc-0002vb-8d for pgsql-general@lists.postgresql.org; Mon, 12 Feb 2018 22:23:36 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1elMVZ-0000v0-2K for pgsql-general@lists.postgresql.org; Mon, 12 Feb 2018 22:23:34 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w1CMNEsP018157; Mon, 12 Feb 2018 17:23:14 -0500 From: Tom Lane To: Thiemo Kellner cc: PostgreSQL General Subject: Re: I do not get the point of the information_schema In-reply-to: <303d3d2c-ef0b-af0a-e4d1-4b17a029fc0f@gelassene-pferde.biz> References: <303d3d2c-ef0b-af0a-e4d1-4b17a029fc0f@gelassene-pferde.biz> Comments: In-reply-to Thiemo Kellner message dated "Mon, 12 Feb 2018 23:01:41 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <18155.1518474194.1@sss.pgh.pa.us> Date: Mon, 12 Feb 2018 17:23:14 -0500 Message-ID: <18156.1518474194@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Thiemo Kellner 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