Re: psql metaqueries with \gexec

From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, PostgreSQL <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql metaqueries with \gexec
Date: 2016-02-21 23:17:08
Message-ID: 56CA4574.6010603@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2016-02-21 23:18:55 Re: Proposal: "Causal reads" mode for load balancing reads without stale data
Previous Message Tomas Vondra 2016-02-21 23:02:03 significant semi join overestimates (with CTEs)