Re: [Pgjdbc-commit] ERROR: syntax error at or near "$1"

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [Pgjdbc-commit] ERROR: syntax error at or near "$1"
Дата
Msg-id 25249.1131295774@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [Pgjdbc-commit] ERROR: syntax error at or near "$1"  (Dave Cramer <pg@fastcrypt.com>)
Список pgsql-jdbc
Dave Cramer <pg@fastcrypt.com> writes:
> On 6-Nov-05, at 9:01 AM, William Harris wrote:
>> intervalStmt = con.prepareStatement( "select current_date +
>> (interval ?)" );

The above is not and never has been correct syntax; the fact that it
failed to fail in previous JDBC versions was accidental.  The syntax
    interval 'literal'
(or in general any type name followed by a string literal) is defined
to work only for literals.  The correct way to do this is either
    CAST(? AS interval)        (SQL standard)
    ?::interval            (Postgres-ism)
See
http://www.postgresql.org/docs/8.0/static/sql-syntax.html#SQL-SYNTAX-CONSTANTS
particularly the note at the end of section 4.1.2.5.

Fraid you're out of luck on the SET example though :-(

            regards, tom lane

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

Предыдущее
От: Dave Cramer
Дата:
Сообщение: Re: [Pgjdbc-commit] ERROR: syntax error at or near "$1"
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: Stable JDBC drivers for 8.1