Обсуждение: "C" libpq-fe.h

Поиск
Список
Период
Сортировка

"C" libpq-fe.h

От
Tulio Oliveira
Дата:
Hi,

I', trying make a few "C" functions thats runs in server-side, with
Postgres superuser permissions.

The PL/PGSQL runs with the users permissions, and the functions that I
write in "C" using the SPI includes, also runs with the users
permissions.

I think that using the "ligpq-fe.h" I can reconect with the Postgres
user.

But all my sample doesn't works... Please, could you send-me any
exemple, the command line for the compiler, and the right directories of
the included files ?


regards,

Tulio Oliveira.

--
======================================================
AKACIA TECNOLOGIA
Desenvolvimento de sistemas para Internet
www.akacia.com.br

foreign keys as arrays

От
"Alan Young"
Дата:
Is there a way I can do something like the following?

create table t1 (
t1id serial,
);

create table t2 (
t1id int[] references t1 (t1id)
);

I know this doesn't work because I get an error message when trying to
insert into t2.

I'd like to be able allow multiple references if possible.  Has anyone found
a way to make this work?

Also, how do I update an array field?

For example, t2.t1id = '{1,2,3}' and I want to add 4 to make it t2.t1id =
'{1,2,3,4}'.

Thanks.
Alan Young
Programmer/Analyst
IDIGlobal.com


Re: foreign keys as arrays

От
Stephan Szabo
Дата:
On Wed, 20 Dec 2000, Alan Young wrote:

> Is there a way I can do something like the following?

Not really this way.  We've talked about possibly at some
point allowing this as an extension to the spec on foreign
keys, but there are some behavioral things that we haven't
really figured out (what if the key isn't a single value
and you want a two dimensional array with key sets in an
array, etc...)

> create table t1 (
> t1id serial,
> );
>
> create table t2 (
> t1id int[] references t1 (t1id)
> );
>
> I know this doesn't work because I get an error message when trying to
> insert into t2.
>
> I'd like to be able allow multiple references if possible.  Has anyone found
> a way to make this work?
>
> Also, how do I update an array field?
>
> For example, t2.t1id = '{1,2,3}' and I want to add 4 to make it t2.t1id =
> '{1,2,3,4}'.


Re: foreign keys as arrays

От
Tulio Oliveira
Дата:
Alan Young wrote:
>
> Is there a way I can do something like the following?
>
> create table t1 (
> t1id serial,
> );
>
> create table t2 (
> t1id int[] references t1 (t1id)
> );
>
> I know this doesn't work because I get an error message when trying to
> insert into t2.
>
> I'd like to be able allow multiple references if possible.  Has anyone found
> a way to make this work?
>
> Also, how do I update an array field?
>
> For example, t2.t1id = '{1,2,3}' and I want to add 4 to make it t2.t1id =
> '{1,2,3,4}'.
>
> Thanks.
> Alan Young
> Programmer/Analyst
> IDIGlobal.com

You must create T1 this form:

CREATE TABLE t1 (
    t1id SERIAL PRIMARY KEY
);


--
======================================================
AKACIA TECNOLOGIA
Desenvolvimento de sistemas para Internet
www.akacia.com.br