Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: validating SQL using DBI

by Errto (Vicar)
on Jun 29, 2009 at 13:48 UTC ( #775674=note: print w/ replies, xml ) Need Help??


in reply to validating SQL using DBI

I don't know Postgres, but in databases I've used, DDL statements are indifferent to transactions and can't be rolled back. Not sure that will be an issue.

But in general, using transactions to validate SQL is not a bad idea. I have an application that does something similar.

If you're having data values interpreted as placeholders, it sounds like your SQL text may not actually be in a form that's valid for an individual statement. I don't know the COPY statement so I may be out of my league here.


Comment on Re: validating SQL using DBI
Re^2: validating SQL using DBI
by erix (Vicar) on Jun 29, 2009 at 14:44 UTC

    Yes, PostgreSQL does transactional DDL, see this page for an example. It is a handy feature but as you can see from that page, not widely implemented.

    It lets you try out changes (adding or dropping indexes, for instance) and evaluating their effects, before actually COMMITting them (or ROLLBACK, as the case may be). (Other sessions are not effected.)

    See also the -1 option of psql (the cli client):

            -1 ("one")      execute command file as a single transaction
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://775674]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (15)
As of 2014-07-31 13:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (248 votes), past polls