Skip site navigation (1) Skip section navigation (2)

Re: [GENERAL] Shared Objects (Dynamic loading)

From: "Jasbinder Bali" <jsbali(at)gmail(dot)com>
To: "Michael Fuhr" <mike(at)fuhr(dot)org>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: [GENERAL] Shared Objects (Dynamic loading)
Date: 2006-08-24 07:51:28
Message-ID: a47902760608240051g3548a739laf4d828b122962fc@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-novice
Actually my function accepts char, so what should be the SQL analogue for
that in postgres?
Thanks,
Jas

On 8/24/06, Michael Fuhr <mike(at)fuhr(dot)org> wrote:
>
> On Thu, Aug 24, 2006 at 02:51:50AM -0400, Jasbinder Bali wrote:
> > Well, the server side code is in ECPG because thats the easiest choice i
> > could see.
> > I really don't know how difficult or beneficial would SPI be. Haven't
> heard
> > of SPI before.
> > I was under the impression that ECPG and libpg are the only two choices
> a
> > developer has in postgresql for database related activities.
>
> ECPG and libpq are client libraries.  Server-side functions can use
> those libraries to make connections to the same or a different
> database, but a function can use SPI to execute commands in the
> same backend in which it's running without having to make a separate
> client connection.  That's more efficient and the commands the
> function runs will be executed in the same transaction as the
> function itself, so if the calling transaction rolls back then
> statements the function executed will roll back.  If the function
> had executed statements over a separate connection, committed them,
> and closed the connection, then those statements wouldn't roll back
> even if the function's transaction rolled back.
>
> > I am using char in postgres function as an analogue for char* in C. Is
> this
> > correct?
> > The link that you gave says varchar* in C has varchar as its analogue in
> > postgresql.
>
> If the function accepts a text argument then see the copytext() and
> concat_text() examples that show how to work with such data.  Look
> at the examples that use the version-1 calling conventions, the
> ones that are declared like this:
>
> PG_FUNCTION_INFO_V1(copytext);
>
> Datum
> copytext(PG_FUNCTION_ARGS)
> {
> ...
> }
>
> --
> Michael Fuhr
>

In response to

Responses

pgsql-novice by date

Next:From: ben sewellDate: 2006-08-24 08:01:06
Subject: postgresql wildcard when parameter is -1
Previous:From: Michael FuhrDate: 2006-08-24 07:43:19
Subject: Re: [GENERAL] Shared Objects (Dynamic loading)

pgsql-general by date

Next:From: Michael MeskesDate: 2006-08-24 09:11:20
Subject: Re: Shared Objects (Dynamic loading)
Previous:From: Michael FuhrDate: 2006-08-24 07:43:19
Subject: Re: [GENERAL] Shared Objects (Dynamic loading)

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group