Using DEFAULT as a parameter value with PQexecPrepare()

Поиск
Список
Период
Сортировка
От EXT-Rothermel, Peter M
Тема Using DEFAULT as a parameter value with PQexecPrepare()
Дата
Msg-id 135FBA69693F3B46A0BE8D4FF49D2D83494A55ACD0@XCH-NW-01V.nw.nos.boeing.com
обсуждение исходный текст
Ответы Re: Using DEFAULT as a parameter value with PQexecPrepare()
Список pgsql-general

I am currently dynamically building a SQL command in my C code like that executes SQL statement like:

 

    INSERT INTO t (c1,c2,c3,c4,c5) VALUES (‘abc’,  1, DEFAULT, 9, 3);

 

I execute the command using PQexec() of libpq.

 

The application logic determines when to use the default values for several columns.

The first two columns do not default values so they must always be specified.

 

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?

 

Doesn’t look like I can do this using the PQexecPrepared() function of libpq.

Doesn’t look like I can do this using PQexecParams() as well.

 

I am using version 8.4 of PostgreSQL.

 

Thanks,

Pete Rothermel

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

Предыдущее
От: Ashesh Vashi
Дата:
Сообщение: Re: EnterpriseDB install of Postgres on Ubuntu 10.04 library path issues - no version information available (required by /lib/libblkid.so.1)
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Hot synchron backup doesn't start