agora inbox for postgres@postgres.berkeley.edu
help / color / mirror / Atom feeddefine function
8+ messages / 7 participants
[nested] [flat]
* define function
@ 1992-03-03 23:13 ramesh <TSRS00%SDNET.BITNET@cmsa.Berkeley.EDU>
1992-03-05 10:28 ` Re: define function
0 siblings, 1 reply; 8+ messages in thread
From: ramesh @ 1992-03-03 23:13 UTC (permalink / raw)
To: legacy
Hi Postgres users,
I have a problem while using a user defined function. When I w
rite function high_pay as given in manaual, I get
WARN : no zero argument postquel function
and When I run the function large_pay, I get
NOTICE : RelationBuildDesc (relationname int4) non existent
WARN : heapopener on int4 failed.
I tried using the syntax given in Comm magz of ACM, but that doesn't
seem to work too. Can anyone write the exact syntax for user defined function
on the network.
Thanks in advance,
Ramesh Shetty.
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: define function
1992-03-03 23:13 define function ramesh <TSRS00%SDNET.BITNET@cmsa.Berkeley.EDU>
@ 1992-03-05 10:28 `
0 siblings, 0 replies; 8+ messages in thread
From: @ 1992-03-05 10:28 UTC (permalink / raw)
To: legacy
you write:
>I have a problem while using a user defined function. When I
>write function high_pay as given in manaual, I get
>WARN : no zero argument postquel function
>and When I run the function large_pay, I get
>NOTICE : RelationBuildDesc (relationname int4) non existent
>WARN : heapopener on int4 failed.
>
>I tried using the syntax given in Comm magz of ACM, but that doesn't
>seem to work too. Can anyone write the exact syntax for user defined function
>on the network.
Support for postquel functions isn't very complete. See the video and
demo queries for examples of supported functionality.
Jeff Meredith
mer@postgres.berkeley.edu
^ permalink raw reply [nested|flat] 8+ messages in thread
* define function
@ 1993-03-24 10:19 vs4623@csc.albany.edu
1993-03-24 18:12 ` Re: define function Mike Olson <mao@postgres.Berkeley.EDU>
0 siblings, 1 reply; 8+ messages in thread
From: vs4623@csc.albany.edu @ 1993-03-24 10:19 UTC (permalink / raw)
To: legacy
Given the following command:
Define fucntion highpay (language="postquel", returntype=setof S)
as retrieve (S.all) where S.salary>500
I get an error message" "Syntax error at or near retrieve". WHY??
I am working on a project that is due soon and have had no luck
with the define function command. ANy help from anyone would be greatly apreciated.
Vicki Schlierer
State University of New York at Albany
School of Business
Email: vs4623@sarah.albany.edu
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: define function
1993-03-24 10:19 define function vs4623@csc.albany.edu
@ 1993-03-24 18:12 ` Mike Olson <mao@postgres.Berkeley.EDU>
0 siblings, 0 replies; 8+ messages in thread
From: Mike Olson @ 1993-03-24 18:12 UTC (permalink / raw)
To: legacy
In message <9303241519.AA19596@postgres.Berkeley.EDU>you write:
> Define fucntion highpay (language="postquel", returntype=setof S)
> as retrieve (S.all) where S.salary>500
>
> I get an error message" "Syntax error at or near retrieve". WHY??
> I am working on a project that is due soon and have had no luck
> with the define function command. ANy help from anyone would be greatly apre
+ciated.
because the function body must be enclosed in quotation marks. see the
man page for define function.
reformulate as
define fucntion highpay (language="postquel", returntype=setof S)
as "retrieve (S.all) where S.salary>500"
^ permalink raw reply [nested|flat] 8+ messages in thread
* define FUNCTION ..
@ 1994-06-26 04:42 Bruce Taneja. <aataneja@cs.mtu.edu>
1994-06-26 05:00 ` Re: define FUNCTION .. Paul M. Aoki <aoki@CS.Berkeley.EDU>
1994-06-26 15:11 ` define FUNCTION .. Mark Costlow <cheeks@swcp.com>
0 siblings, 2 replies; 8+ messages in thread
From: Bruce Taneja. @ 1994-06-26 04:42 UTC (permalink / raw)
To: legacy
Howdy again !,
.. haven't got any response to my previous query yet , and
here is another one .. :(
-------------
my test function in circle.c : (compiled ok..)
bool test(t, char1)
TUPLE t;
char *char1;
{
BCIRCLE * bca = (BCIRCLE*) GetAttributeByName(t, "a");
return (char1 == "1") ; /*return +ve if i/p was 1 */
}
-------------
and the postgres reaction to it:
*
define function test
(language = "c", returntype = bool)
arg is (tutorial, char16)
as "/usr/local/postgres/bcircle.o" \g
Query sent to backend is "define function test (language = "c", returntype = bool) arg is (tutorial, char16) as "/usr/local/postgres/bcircle.o" "
DEFINE
Go
* retrieve (tutorial.all)
where test(tutorial, "0") \g
Query sent to backend is "retrieve (tutorial.all) where test(tutorial, "0") "
NOTICE:Jun 26 00:33:32:type mismatch in invocation of function test
WARN:Jun 26 00:33:32:no such attribute or function test
---------------------------
I think postgres does not like the "0" string parameter..
Is there any way to pass strings in "quotes" to your
defined function ?? (like my "0" ) ??
----------------------------
thanks ..
Bruce!
==============================================================================
To add/remove yourself to/from the POSTGRES mailing list: send mail with
the subject line ADD or DEL to "postgres-request@postgres.Berkeley.EDU"
If this fails, send mail to "post_questions@postgres.Berkeley.EDU" and
a human will deal with it. DO NOT post to the "postgres" mailing list.
==============================================================================
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: define FUNCTION ..
1994-06-26 04:42 define FUNCTION .. Bruce Taneja. <aataneja@cs.mtu.edu>
@ 1994-06-26 05:00 ` Paul M. Aoki <aoki@CS.Berkeley.EDU>
1 sibling, 0 replies; 8+ messages in thread
From: Paul M. Aoki @ 1994-06-26 05:00 UTC (permalink / raw)
To: Bruce Taneja. <aataneja@cs.mtu.edu>; +Cc: legacy
aataneja@cs.mtu.edu (Bruce Taneja.) writes:
> Query sent to backend is "retrieve (tutorial.all) where test(tutorial, "0") "
> NOTICE:Jun 26 00:33:32:type mismatch in invocation of function test
> WARN:Jun 26 00:33:32:no such attribute or function test
does it work when you typecast the constant (i.e., "0"::char16)?
--
Paul M. Aoki | CS Div., Dept. of EECS, UCB | aoki@CS.Berkeley.EDU
| Berkeley, CA 94720-1776 | ...!uunet!ucbvax!aoki
==============================================================================
To add/remove yourself to/from the POSTGRES mailing list: send mail with
the subject line ADD or DEL to "postgres-request@postgres.Berkeley.EDU"
If this fails, send mail to "post_questions@postgres.Berkeley.EDU" and
a human will deal with it. DO NOT post to the "postgres" mailing list.
==============================================================================
^ permalink raw reply [nested|flat] 8+ messages in thread
* define FUNCTION ..
1994-06-26 04:42 define FUNCTION .. Bruce Taneja. <aataneja@cs.mtu.edu>
@ 1994-06-26 15:11 ` Mark Costlow <cheeks@swcp.com>
1 sibling, 0 replies; 8+ messages in thread
From: Mark Costlow @ 1994-06-26 15:11 UTC (permalink / raw)
To: aataneja@cs.mtu.edu; +Cc: legacy
On Sun, 26 Jun 1994 00:42:43 -0400 (EDT),
bbx!mimbres!cs.mtu.edu!aataneja (Bruce Taneja.) said:
Bruce> my test function in circle.c : (compiled ok..)
Bruce> bool test(t, char1)
Bruce> TUPLE t;
Bruce> char *char1;
Bruce> {
Bruce> BCIRCLE * bca = (BCIRCLE*) GetAttributeByName(t, "a");
Bruce> return (char1 == "1") ; /*return +ve if i/p was 1 */
Bruce> } ^^^^^^^^^^^^
Bruce> -------------
That's a pointer comparison (comparing a parameter to a string constant).
I think what you want to do is compare the data pointed to by those
pointers:
return(strcmp(char1, "1") == 0);
Or maybe:
return (*char1 == '1');
>>Chx
--
Mark Costlow
Southwest Cyberport
cheeks@swcp.com
==============================================================================
To add/remove yourself to/from the POSTGRES mailing list: send mail with
the subject line ADD or DEL to "postgres-request@postgres.Berkeley.EDU"
If this fails, send mail to "post_questions@postgres.Berkeley.EDU" and
a human will deal with it. DO NOT post to the "postgres" mailing list.
==============================================================================
^ permalink raw reply [nested|flat] 8+ messages in thread
* define function
@ 1995-04-26 20:33 Zhennong Wang <wang@hilbert.Berkeley.EDU>
0 siblings, 0 replies; 8+ messages in thread
From: Zhennong Wang @ 1995-04-26 20:33 UTC (permalink / raw)
To: legacy
hi,
I am using the postgres to build a database. I have a question to ask.
When I use the "define function" to define a function, the system
requires the "returntype", but I don't want this( just like the C
language "void"), HOw can I solve this problem? Thank you in advance.
wang
==============================================================================
To add/remove yourself to/from the POSTGRES mailing list: send mail with
the subject line ADD or DEL to "postgres-request@postgres.Berkeley.EDU".
If this fails, send mail to "post_questions@postgres.Berkeley.EDU" and
a human will deal with it. DO NOT post to the "postgres" mailing list.
==============================================================================
URL: http://s2k-ftp.CS.Berkeley.EDU:8000/postgres/
^ permalink raw reply [nested|flat] 8+ messages in thread
end of thread, other threads:[~1995-04-26 20:33 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1992-03-03 23:13 define function ramesh <TSRS00%SDNET.BITNET@cmsa.Berkeley.EDU>
1992-03-05 10:28 `
1993-03-24 10:19 define function vs4623@csc.albany.edu
1993-03-24 18:12 ` Mike Olson <mao@postgres.Berkeley.EDU>
1994-06-26 04:42 define FUNCTION .. Bruce Taneja. <aataneja@cs.mtu.edu>
1994-06-26 05:00 ` Re: define FUNCTION .. Paul M. Aoki <aoki@CS.Berkeley.EDU>
1994-06-26 15:11 ` define FUNCTION .. Mark Costlow <cheeks@swcp.com>
1995-04-26 20:33 define function Zhennong Wang <wang@hilbert.Berkeley.EDU>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox