Re: variables in ad hoc queries

From: Iain Barnett <iainspeed(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: variables in ad hoc queries
Date: 2009-09-29 13:31:05
Message-ID: BE4A60A0-D6C4-4975-96DA-CE4CF2AAAEDC@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sam Mason 2009-09-29 13:35:34 Re: query is taking longer time after a while
Previous Message el dorado 2009-09-29 13:28:59 Re[3]: Build PG 8.4 (MinGW vs. MSVC)