Re: Using DEFAULT as a parameter value with PQexecPrepare()

Поиск
Список
Период
Сортировка
От Greg Sabino Mullane
Тема Re: Using DEFAULT as a parameter value with PQexecPrepare()
Дата
Msg-id abf5366ce571ef7e1c6812bd7aee7bdf@biglumber.com
обсуждение исходный текст
Ответ на Using DEFAULT as a parameter value with PQexecPrepare()  ("EXT-Rothermel, Peter M" <Peter.M.Rothermel@boeing.com>)
Ответы Re: Using DEFAULT as a parameter value with PQexecPrepare()
Список pgsql-general
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160


> I was looking for a to use a prepared statement for this operation.
>
>  PREPARE myinsert  AS "INSERT INTO t ( c1, c2, c3, c4, c5) VALUES ( $1, $2, $3, $4, $5);
>
> Now I want to execute this prepared statement something like:
>
> EXECUTE myinsert ( 'abc', 1, DEFAULT, 9, 3);
>
> Is there any way to specify the column's default value as a parameter value?

You will need to have separate prepared statements. In the case above,
you can use either:

PREPARE myinsert2 AS INSERT INTO t(c1,c2,c3,c4,c5) VALUES ($1,$2,DEFAULT,$3,$4);

or

PREPARE myinsert2 AS INSERT INTO t(c1,c2,c4,c5) VALUES ($1,$2,$3,$4);

- --
Greg Sabino Mullane greg@turnstep.com
End Point Corporation http://www.endpoint.com/
PGP Key: 0x14964AC8 201204052214
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iEYEAREDAAYFAk9+UiQACgkQvJuQZxSWSsikAwCg/f28B4vLzPvurQtf8hmdhqO4
dHgAoIR8nuy89zN3t46FdoQMDm3oWIE3
=wCLM
-----END PGP SIGNATURE-----



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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Hot synchron backup doesn't start
Следующее
От: hamann.w@t-online.de
Дата:
Сообщение: question about alternate ordering of results