pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
which guru know this ??
2+ messages / 2 participants
[nested] [flat]

* which guru know this ??
@ 1999-05-05 08:44 Carlos Peralta Ramirez <cperalta@hera.inf.ucv.cl>
  0 siblings, 0 replies; 2+ messages in thread

From: Carlos Peralta Ramirez @ 1999-05-05 08:44 UTC (permalink / raw)
  To: pgsql-novice <pgsql-novice@hub.org>; pgsql-hackers <pgsql-hackers@postgresql.org>; pgsql-sql; pgsql-general <pgsql-general@postgresql.org>



Primary, Sorry for my english !!!


Hi,

I ´m developing a several test database, for study. But I can´t create
any function, every time ERROR appears.
I write a C code in a plus2.c file

#include <pgsql/postgres.h>

int4 plus2(int4 a,int4 b)
{
return(a+b);
}

main() /* For getting *.out*/
{
}

, then I compile it (I made this of two ways)

cc -c plus2.c       /* I get the object file *.o */

or

cc plus2.c plus2.out  /*I get the *.out file */

When I create the function on postgresql, occurs this

db=> create function plus2(int4,int4) returns int4 as
'/var/lib/pgsql/plus2.o' language 'c';
CREATE

or

db=> create function plus2(int4,int4) returns int4 as
'/var/lib/pgsql/plus2.out' language 'c';
CREATE

Wherever, when I call the function plus2 from Sql sentence ...

db=> select plus2(6,6);
ERROR:  Load of file /var/lib/pgsql/plus2.o failed:
(ô@(ô@/pgsql/plus2.o: ELF file's phentsize not the expected size

or, with plus2.out

db=> select plus2(6,6);
PQexec() -- Request was sent to backend, but backend closed the channel
before responding.
This probably means the backend terminated abnormally before or while
processing the request.

If anybody can help me, thank !!!

PD: I don´t disturb you, if I don´t need it really.






^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* RE: [GENERAL] which guru know this ??
@ 1999-05-05 19:52 Michael J Davis <michael.j.davis@tvguide.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael J Davis @ 1999-05-05 19:52 UTC (permalink / raw)
  To: 'Carlos Peralta Ramirez' <cperalta@hera.inf.ucv.cl>; pgsql-novice <pgsql-novice@hub.org>; pgsql-hackers <pgsql-hackers@postgreSQL.org>; pgsql-sql; pgsql-general <pgsql-general@postgreSQL.org>

Try:

	#include <pgsql/postgres.h>

	int plus2(int a,int b)
	{
	return(a+b);
	}


	cc -c plus2.c       /* I get the object file *.o */
gcc -shared -o plus2.so plus2.o  /* you need a library file */

from psql: 

	create function plus2(int4,int4) returns int4 as
	'/var/lib/pgsql/plus2.so' language 'c';   -- assuming /var/lib/pgsql
is the location of plus2.so

	-----Original Message-----
	From:	Carlos Peralta Ramirez [SMTP:cperalta@hera.inf.ucv.cl]
	Sent:	Wednesday, May 05, 1999 2:44 AM
	To:	pgsql-novice; pgsql-hackers; pgsql-sql; pgsql-general
	Subject:	[GENERAL] which guru know this ??



	Primary, Sorry for my english !!!


	Hi,

	I ´m developing a several test database, for study. But I can´t
create
	any function, every time ERROR appears.
	I write a C code in a plus2.c file

	#include <pgsql/postgres.h>

	int4 plus2(int4 a,int4 b)
	{
	return(a+b);
	}

	main() /* For getting *.out*/
	{
	}

	, then I compile it (I made this of two ways)

	cc -c plus2.c       /* I get the object file *.o */

	or

	cc plus2.c plus2.out  /*I get the *.out file */

	When I create the function on postgresql, occurs this

	db=> create function plus2(int4,int4) returns int4 as
	'/var/lib/pgsql/plus2.o' language 'c';
	CREATE

	or

	db=> create function plus2(int4,int4) returns int4 as
	'/var/lib/pgsql/plus2.out' language 'c';
	CREATE

	Wherever, when I call the function plus2 from Sql sentence ...

	db=> select plus2(6,6);
	ERROR:  Load of file /var/lib/pgsql/plus2.o failed:
	(ô@(ô@/pgsql/plus2.o: ELF file's phentsize not the expected size

	or, with plus2.out

	db=> select plus2(6,6);
	PQexec() -- Request was sent to backend, but backend closed the
channel
	before responding.
	This probably means the backend terminated abnormally before or
while
	processing the request.

	If anybody can help me, thank !!!

	PD: I don´t disturb you, if I don´t need it really.


	



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~1999-05-05 19:52 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-05-05 08:44 which guru know this ?? Carlos Peralta Ramirez <cperalta@hera.inf.ucv.cl>
1999-05-05 19:52 RE: [GENERAL] which guru know this ?? Michael J Davis <michael.j.davis@tvguide.com>

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