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

C Function with Arrays Question

From: Achilleus Mantzios <rnd(at)gatewaynet(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Cc: pgsql-general(at)postgresql(dot)org
Subject: C Function with Arrays Question
Date: 2002-03-26 12:00:00
Message-ID: 02032614000004.09965@pc216 (view raw, whole thread or download thread mbox)
Lists: pgsql-generalpgsql-sql
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 */



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(at)dynacomtm(dot)com


pgsql-sql by date

Next:From: ArguileDate: 2002-03-26 13:51:21
Subject: Re: Cleaning up template 1
Previous:From: Achilleus MantziosDate: 2002-03-26 08:12:12
Subject: Arrays Design Question

pgsql-general by date

Next:From: Arsalan ZaidiDate: 2002-03-26 12:22:12
Subject: Speed diff cause by multi-byte support
Previous:From: Denis GasparinDate: 2002-03-26 10:06:48
Subject: Altering a CHAR(4) column CHAR(5) changing pg_attribute

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