Re: Feature Request for Debugging SQL in PGAdmin3 when SQL contains variables - Mailing list pgadmin-support

From Dan Shoubridge
Subject Re: Feature Request for Debugging SQL in PGAdmin3 when SQL contains variables
Date
Msg-id 002201cb8649$b954ad20$2bfe0760$@autovhc.co.uk
Whole thread Raw
In response to Re: Feature Request for Debugging SQL in PGAdmin3 when SQL contains variables  ("Paragon Corporation" <lr@pcorp.us>)
Responses Re: Feature Request for Debugging SQL in PGAdmin3 when SQL contains variables
List pgadmin-support
>>Dan,
>> Ok, I understand and it's a shame the vars aren't strong typed. It's
little things like that that make me want SQL Server back. It doesn't seem
like a big thing to some people, but for a lot of developers the amount of
work added by this when debugging sql adds up over time. 

>I know it's a new invention in PostgreSQL 9.0 so might not be an option for
you, but wouldn't the new 

>DO command do what you are looking for?

pgScript looks better for me atm, as you can have @ to specify variables, it
doesn't let you in anonymous code blocks - this defeats the object of
efficient debugging entirely (I'd have to remove the : from the sql than add
it again afterwards)

I tried the following:

DO language plpgsql $$
DECLARE x integer;
BEGINx := 7; SELECT * FROM site WHERE sitecode = x;END$$;

but got the error

ERROR:  query has no destination for result data
HINT:  If you want to discard the results of a SELECT, use PERFORM instead.
CONTEXT:  PL/pgSQL function "inline_code_block" line 7 at SQL statement

********** Error **********

ERROR: query has no destination for result data
SQL state: 42601
Hint: If you want to discard the results of a SELECT, use PERFORM instead.
Context: PL/pgSQL function "inline_code_block" line 7 at SQL statement

It looks like I need to declare the returning type, or specify to output to
the dataoutput window? But the documentation doesn't really expand on this
scenario, and there isn't any examples I could find through Google.


>http://wiki.postgresql.org/index.php?title=PostgreSQL_9.0#Anonymous_Functio
n
>s_.28aka_Anonymous_Blocks.29

>Leo



>--
>Sent via pgadmin-support mailing list (pgadmin-support@postgresql.org) To
make changes to your subscription:
>http://www.postgresql.org/mailpref/pgadmin-support



pgadmin-support by date:

Previous
From: "Paragon Corporation"
Date:
Subject: Re: Feature Request for Debugging SQL in PGAdmin3 when SQL contains variables
Next
From: Raymond O'Donnell
Date:
Subject: Re: Feature Request for Debugging SQL in PGAdmin3 when SQL contains variables