checking SQL statement/subexpression validity

Поиск
Список
Период
Сортировка
От David Garamond
Тема checking SQL statement/subexpression validity
Дата
Msg-id 42097BB3.2080907@zara.6.isreserved.com
обсуждение исходный текст
Ответы Re: checking SQL statement/subexpression validity  (Mike Nolan <nolan@gw.tssi.com>)
Список pgsql-general
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

В списке pgsql-general по дате отправления:

Предыдущее
От: Art Fore
Дата:
Сообщение: Database permissions
Следующее
От: "Rick Schumeyer"
Дата:
Сообщение: how to delete from a view