Re: [HACKERS] Press Release Draft - 2016-02-09 Cumulative Update - Mailing list pgsql-hackers

From Jim Nasby
Subject Re: [HACKERS] Press Release Draft - 2016-02-09 Cumulative Update
Date
Msg-id 891336d3-cb33-eab4-0de6-140edd4f8b47@BlueTreble.com
Whole thread Raw
In response to Re: [HACKERS] Press Release Draft - 2016-02-09 Cumulative Update  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-hackers
On 2/8/17 2:51 PM, Alvaro Herrera wrote:
>> I always have a bit of mixed feelings with these kind of string
>> manipulations on dynamic SQL.
> It may look a bit nasty, but locking tables for long periods (or being
> without an important index for a period) is much worse in production
> scenarios.

I think posting a recipe in the wiki is a great idea (especially if it 
handles corner cases like constraints). I'm not so keen on trying to 
code it entirely in psql though. I think it'd be a lot cleaner to have a 
plpgsql function that uses format() to construct the appropriate 
commands to run and then spit that out as text. Users can either cut and 
paste that, or they can \gset it to a variable that they then execute, 
or they can capture the output to a file which they execute.

The big advantage to this is by default you see what commands would be 
run, but you can still fully automate if you want to without much extra 
effort.
-- 
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)



pgsql-hackers by date:

Previous
From: Jim Nasby
Date:
Subject: [HACKERS] Improve OR conditions on joined columns.
Next
From: Corey Huinker
Date:
Subject: Re: [HACKERS] contrib modules and relkind check