Re: SPI_execute_with_args call
От | Gavin Flower |
---|---|
Тема | Re: SPI_execute_with_args call |
Дата | |
Msg-id | 5183921F.30509@archidevsys.co.nz обсуждение исходный текст |
Ответ на | SPI_execute_with_args call (Yuriy Rusinov <yrusinov@gmail.com>) |
Ответы |
Re: SPI_execute_with_args call
|
Список | pgsql-general |
On 03/05/13 21:19, Yuriy Rusinov wrote:
I can't answer your question.Hello, colleagues !I have to write random number generator state into database tableTable structure istable rand_state{id serial not null primary key,state_rand bytea};In C-function I dosize_t nr_ins = strlen ("insert into rand_state (state_rand) values ($1);");char * r_sql = (char *) palloc (nr_ins + 1);strncpy (r_sql, "insert into rand_state (state_rand) values ($1);", nr_ins);Oid * oids = (Oid *)palloc (sizeof (Oid));Datum * val = PointerGetDatum (randBuf);*oids = BYTEAOID;const char * nulls = "NULL";int rins = SPI_execute_with_args (r_sql, 1, oids, val, nulls, false, 1);randBuf is a void * pointer that contains random number generator state,when I try to execute SPI_execute_with_args (r_sql, 1, oids, val, nulls, false, 1); I receive errorThe connection to the server was lost. Attempting reset: Failed.Could you give some work examples for SPI_execute_with_args because I didn't find them in documentation.Thanks a lot.--
Best regards,
Sincerely yours,
Yuriy Rusinov.
However, I can say that PRIMARY KEY implies NOT NULL (also an UNIQUE index), so you don't need to explicitly add NOT NULL when you are specifying PRIMARY KEY!
Cheers,
Gavin
В списке pgsql-general по дате отправления: