Search Postgresql Archives

checking SQL statement/subexpression validity

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I need to check whether a SQL subexpression (to be used in WHERE clause), e.g.:

 colname > 200

or an entire SELECT statement, e.g.:

 SELECT * FROM t1, t2 WHERE colname > 200

is syntactically valid. Is there a quick (and also safe) way to do this? I'm thinking of doing "SELECT ... FROM ... WHERE <SQLexpr> LIMIT 0" for #1, but I'm not sure if it's 100% safe; and I don't know what to do with #2. AFAIK, in, say, Perl's DBI, $dbh->prepare() doesn't check SQL syntax and $sth->execute() actually executes the statement.

--
dave

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@xxxxxxxxxxxxxx

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux