Re: psql metaqueries with \gexec - Mailing list pgsql-hackers

From Jim Nasby
Subject Re: psql metaqueries with \gexec
Date
Msg-id 56CA4574.6010603@BlueTreble.com
Whole thread Raw
In response to psql metaqueries with \gexec  (Corey Huinker <corey.huinker@gmail.com>)
Responses Re: psql metaqueries with \gexec
List pgsql-hackers
On 2/19/16 7:32 PM, Corey Huinker wrote:

Wow, and I thought *I* liked metaprogramming! :)

I like what you've proposed, though I am wondering if you considered 
doing something server-side instead? It seems a shame to do all this 
work and exclude all other tools.

I frequently find myself creating a function that is just a wrapper on 
EXECUTE for this purpose, but obviously that has transactional limitations.

FWIW, I also wish we had something better than format() for this stuff. 
I did create [1] towards that end, but it currently depends on some C 
code, which is cumbersome.

> I am not sure that "gexec" is the right name for this command. Others
> considered were \execute_each, \meta, \gmeta, \geach, as well as adding
> a "<" parameter to the \g command.

\gexec sounds fine to me. I would think \g < would be something done at 
the shell level...

[1] 
https://github.com/decibel/trunklet-format/blob/master/doc/trunklet-format.asc
-- 
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



pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: about google summer of code 2016
Next
From: Jim Nasby
Date:
Subject: Re: Allow to specify (auto-)vacuum cost limits relative to the database/cluster size?