From: | Francisco Olarte <folarte(at)peoplecall(dot)com> |
---|---|
To: | Xtra Coder <xtracoder(at)gmail(dot)com> |
Cc: | Merlin Moncure <mmoncure(at)gmail(dot)com>, PostgreSQL General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Any reasons for 'DO' statement not returning result? |
Date: | 2016-08-13 08:57:18 |
Message-ID: | CA+bJJbzFR_hfppSeS2Ly-JOAupNF5QyhgSSM=W-=KcXqisVEfQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Fri, Aug 12, 2016 at 11:34 PM, Xtra Coder <xtracoder(at)gmail(dot)com> wrote:
...
> In my particular case I'm more interested in an easy way to create complex
> SELECTs that require usage of variables in the one-time through-away scripts
> (some-time during experiments for implementation of functions, to see
> immediate results of the intermediate code). The easiest way would be
> MsSQL-like when declaring a variable outside of SP actually makes it visible
> globally in current session. In such case I do not need 'DO' at all and this
> is simple. Probably PostgreSQL has another way to make that thing simple.
If you are just interested in avoiding some mistakes, and/or
parametrizing some queries from the command line, psql ( the CLI
program ) has macro expansion with some sql quoting capabilities, see
https://www.postgresql.org/docs/9.5/static/app-psql.html#APP-PSQL-VARIABLES
and be sure to scroll down to "SQL Interpolation" after the built in
variables list and read that. I've used it several times, just
remember it's a macro processor and it's done by psql, not by the
server.
Francisco Olarte.
From | Date | Subject | |
---|---|---|---|
Next Message | Martín Marqués | 2016-08-13 13:31:53 | Re: BDR Cluster vs DB Config |
Previous Message | Francisco Olarte | 2016-08-13 08:49:56 | Re: Corrupted Data ? |