Re: Query - Mailing list pgsql-general

From Eric G. Miller
Subject Re: Query
Date
Msg-id 20010408001739.D13742@calico.local
Whole thread Raw
In response to Query  ("Atul" <atulk@newgen.co.in>)
List pgsql-general
On Fri, Apr 06, 2001 at 06:57:03PM +0530, Atul wrote:
> Hi,
>
> I have a query regarding composite types (user-defined types). I have
> defined a type alongwith its input and output functions. But I am not
> able to access the type using my PL/pgSQL function. My type is as
> follows
>
> typedef struct Sample { int nCtr1, int nCtr2 } Sam;
>
> If anyone has some clue about it please mail back.

PL/PgSQL is not going to be able to look into your structure if that's
what you want.  PostgreSQL treats such things as blobs of memory.  You
might define accessor functions though...

int4
SampleGetnCtr1 (Sam *s)
{
    return s->nCtr1;
}

Etc...

Then, maybe, you can call the function(s) to get/set it's parts...

SELECT sample_get_ctr1(mysample) INTO foo FROM ... ;

--
Eric G. Miller <egm2@jps.net>

pgsql-general by date:

Previous
From: Mario Weilguni
Date:
Subject: strange query plan
Next
From: "Eric G. Miller"
Date:
Subject: Re: Inheritance and referential integritry in 7.0.3