Re: variables in ad hoc queries - Mailing list pgsql-general

From Iain Barnett
Subject Re: variables in ad hoc queries
Date
Msg-id BE4A60A0-D6C4-4975-96DA-CE4CF2AAAEDC@gmail.com
Whole thread Raw
In response to Re: variables in ad hoc queries  (Brian Modra <brian@zwartberg.com>)
List pgsql-general
Sorry, in oversimplifying for clarity I was making it more unclear!

Whenever I write a function, I like to write a quick ad hoc test to
go with it in the comments. It means I can also test combinations of
functions together quickly, without having to build other functions
first, and gives anyone reading the function a quick idea of the type
of inputs/outputs they might see. I've mostly worked with SQL Server,
and with that I can write statements that might need to be within a
function in ad hoc fashion.

A common example is when I write an insert statement that returns the
primary key of the inserted row. I'd like to capture that in a
variable and run it through other functions. To be able to declare
variables outside a function would be helpful in this respect.

It's just a quick way to an easy test, in my view, but if it's not
possible then that's ok, I'll just write full blown test functions
from the start.


Regards,
Iain

pgsql-general by date:

Previous
From: el dorado
Date:
Subject: Re[3]: Build PG 8.4 (MinGW vs. MSVC)
Next
From: Sam Mason
Date:
Subject: Re: query is taking longer time after a while