Re: No longer possible to query catalogs for index capabilities?

From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>, Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Stephen Frost <sfrost(at)snowman(dot)net>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: No longer possible to query catalogs for index capabilities?
Date: 2016-08-06 17:57:26
Message-ID: e1514cae-2e94-5573-3e9e-c4a07e5f8048@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 8/6/16 10:13 AM, Bruce Momjian wrote:
> On Sat, Aug 6, 2016 at 04:04:41PM +0100, Andrew Gierth wrote:
>>>>>>> "Bruce" == Bruce Momjian <bruce(at)momjian(dot)us> writes:
>>
>> Bruce> Would it be helpful to output an array of strings representing
>> Bruce> the index definition?
>>
>> >> Why would that help, if the point is to enable programmatic access
>> >> to information?
>>
>> Bruce> I was thinking an array of strings would avoid problems in
>> Bruce> having to re-scan the output for tokens.
>>
>> OK, but that still leaves the issue of how to interpret each string,
>> yes?
>
> Yes, you still have to parse it, just not scan/tokenize it.

That's an improvement. For some scenarios maybe it's enough. But I also
don't see what's wrong with having the ability to probe for specific
capabilities. I've needed to do this for unit tests, and for some items
it's a real bear.

Trigger definitions are an example. I've done this in the past in unit
tests to ensure that a trigger was defined in a particular way. Some
data is available directly in the catalog, but getting at other info
would have required hard-coding knowledge of specific bit patterns into
the query. Instead of doing that I elected to parse
pg_get_triggerdef[1], but that's hardly satisfying either.

1: https://github.com/decibel/cat_tools/blob/master/sql/cat_tools.sql#L339
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com
855-TREBLE2 (855-873-2532) mobile: 512-569-9461

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Gierth 2016-08-06 17:57:57 Re: Oddity with NOT IN
Previous Message Pavel Stehule 2016-08-06 17:03:52 Re: Oddity with NOT IN