From: | Bill Harper <bharper(at)solutionst(dot)com> |
---|---|
To: | Carlos Moreno <moreno(at)mochima(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Is this legal SQL? Is it a good practice? |
Date: | 2004-08-24 22:17:00 |
Message-ID: | 412BBE5C.6080404@solutionst.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Carlos Moreno wrote:
> But I'm wondering -- is this a PostgreSQL extension,
> or is it "legal SQL"?
This is a reasonably standard result from an "exec" or "execute" call,
but I am not an SQL expert. How else could the psql command
line utility process command files?
> What happens if the first command is ok but the second
> one fails?
I've not used this interface extensively because I do
mostly transactional work. The easy way to test would be to
make the second statement fail on a syntax error.
> Any reason why this should be avoided?
Yes. You've raised the core issue in your question about what happens
when a command fails. For efficiency and convenience, use prepared
statements.
For greater efficiency, execute stored procedures to do your work
In general, my web applications use prepared statements for moderate
efficiency.
For batch applications, I would use stored procedures or embedded SQL (both
provide the advantage of stored, optimized query plans).
-bill
From | Date | Subject | |
---|---|---|---|
Next Message | Greg Stark | 2004-08-24 22:29:26 | Deadlocks caused by referential integrity checks |
Previous Message | Gavin M. Roy | 2004-08-24 22:11:34 | Re: Gentoo for production DB server? |