Re: Debugging question ... - Mailing list pgsql-novice

From Josh Tolley
Subject Re: Debugging question ...
Date
Msg-id e7e0a2570711082150x1017108fq6217011f2931f7ec@mail.gmail.com
Whole thread Raw
In response to Debugging question ...  (Robert Bernabe <rbernabe@sandmansystems.com>)
Responses Re: Debugging question ...  (Robert Bernabe <rbernabe@sandmansystems.com>)
List pgsql-novice
On Nov 7, 2007 8:56 PM, Robert Bernabe <rbernabe@sandmansystems.com> wrote:
> Hi All,
> I've been using MS SQL 2k and it's bundled query analyzer SQL editor for
> more than 5 years. I am exploring postgres right now and I hit a snag I
> don't understand...
>
> MS SQL : debugging - use query analyzer, declare variables, plug in code
> and test...
>
> PG : using PGAdminIII editor :
>
> declare
>
> tst int; (or whatever variable)
>
> there is an error already....syntax error...
>
> I did some research and it seems that variables cannot be declared
> outside a function scope? Looking at functions within PG, the
> implementation looks like one massive dynamic sql string....
>
> I wanted to figure out how PG handles single quotes, double quotes,
> string concats and such.... problem is that the editor won't even let me
> declare variables...ahmm help? how does one debug in PG? what tool?
> anything like query analyzer of MS SQL? why can't I declare variables
> and print the values out to check and debug? HELP? Many Thanks in
> advance...
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
>

I recommend starting with the documentation. It sounds like you'd like
to do pl/pgsql stuff, so you might try this link:
http://www.postgresql.org/docs/8.2/interactive/plpgsql.html. Take
sample functions from there, and adapt them to do what you need. It's
easier to take something that works and learn the postgresql idioms
from that rather than to take something from MS SQL and try to replace
MS SQL-isms with PostgreSQL-isms.

- Josh/eggyknap

pgsql-novice by date:

Previous
From: "David Monarchi"
Date:
Subject: Constructing two-dimensional arrays from a query
Next
From: Robert Bernabe
Date:
Subject: Re: Debugging question ...