pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Achilleus Mantzios <rnd@gatewaynet.com>
To: pgsql-sql@postgresql.org
Cc: pgsql-general@postgresql.org
Subject: C Function with Arrays Question
Date: Tue, 26 Mar 2002 14:00:00 +0200
Message-ID: <02032614000004.09965@pc216> (raw)

Hi,
Is there a way of accessing _float8 (float8[]) values inside of
a server-side C function??

For instance imagine:

# \d formulatest 
           Table "formulatest"
 Column  |        Type        | Modifiers 
---------+--------------------+-----------
 formula | double precision[] | 

# insert into formulatest values('{2.3,3.3}');
# insert into formulatest values('{4.3,5.3}');

and then write a C function named formula

float8 *formula(x,formarray)
float8 *x;
_float8 *formarray; /* This is serious part of the question!! */
{
	float8 *result = (float8 *) malloc(sizeof(float8));
	/* what happened to palloc in pgsql 7.2??,
	* Also what happened to postgres.h?? 
	*/

	*result = *formarray[0];
	return result;
/* This is pseudo code to demonstrate the question */
}

Thanx.

P.S.

7.2 runs quite stable on my Linux 2.4.7.
JDBC built without a problem, and also supports Arrays (at least one 
dimension for sure).

-- 
Achilleus Mantzios
S/W Engineer
IT dept
Dynacom Tankers Mngmt
tel:    +30-10-8981112
fax:    +30-10-8981877
email:  it@dynacomtm.com
        rnd@gatewaynet.com




view thread (2+ messages)  latest in thread

Message-ID: <02032614000004.09965@pc216>
Permalink:  ../02032614000004.09965@pc216/
Also on:    postgresql.org/message-id/02032614000004.09965@pc216

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: rnd@gatewaynet.com, pgsql-general@postgresql.org
  Subject: Re: C Function with Arrays Question
  In-Reply-To: <02032614000004.09965@pc216>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox