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

plperl db access documentation enhancement

From: Alexey Klyukin <alexk(at)commandprompt(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: plperl db access documentation enhancement
Date: 2010-01-29 10:01:20
Message-ID: 7536E058-0283-49DF-982A-4396DB199C9D@commandprompt.com (view raw or flat)
Thread:
Lists: pgsql-hackers
Hello,

We were asked by Enova Financial to improve the documentation of PL/Perl database access functions.
Alvaro and me worked on that and we produced the patch that is attached. It splits initial block of functions
into the groups with the description directly following each of the group, corrects couple of mistakes and
adds an example.

One of the existing mistakes was confusion in definitions of spi_exec_prepared and spi_query_prepared.
Another one is usage of INTEGER type to return the result of spi_prepare in the example for prepared queries.
When trying to execute that function I've got the following error:

postgres=# CREATE OR REPLACE FUNCTION init() RETURNS INTEGER AS $#
	$_SHARED{my_plan} = spi_prepare( 'SELECT (now() + $1)::date AS now', 'INTERVAL');
$$ LANGUAGE plperl;

CREATE FUNCTION

postgres=# select init();
ERROR:  invalid input syntax for integer: "0x1007d6f40"
CONTEXT:  PL/Perl function "init"

Since the return value is not used anyway, I've changed the return type of the function declaration in the example to VOID.

I think this is a good reason to suggest backpatching these changes  down to 8.2. 



Attachment: plperl_db.diff
Description: application/octet-stream (7.8 KB)

Responses

pgsql-hackers by date

Next:From: Simon RiggsDate: 2010-01-29 10:08:41
Subject: Re: Hot Standby: Relation-specific deferred conflict resolution
Previous:From: Heikki LinnakangasDate: 2010-01-29 09:33:22
Subject: Re: Hot Standby: Relation-specific deferred conflict resolution

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