Re: No longer possible to query catalogs for index capabilities? - Mailing list pgsql-hackers

From Jim Nasby
Subject Re: No longer possible to query catalogs for index capabilities?
Date
Msg-id e1514cae-2e94-5573-3e9e-c4a07e5f8048@BlueTreble.com
Whole thread Raw
In response to Re: No longer possible to query catalogs for index capabilities?  (Bruce Momjian <bruce@momjian.us>)
List 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@momjian.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



pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: Oddity with NOT IN
Next
From: Andrew Gierth
Date:
Subject: Re: Oddity with NOT IN