473,772 Members | 3,665 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PL/Perl returning multiple rows

Greetings,

I'm trying to write a pl/perl function that will return multiple rows.
I've looked all over the web and only found vague references as to how
to do this (some said it was possible, and some said it wasn't but it
was for older versions of Postgres).

Basically I would *love* to be able to do something like this:

SELECT some_id
FROM some_table
WHERE ....
INTERSECT
SELECT perlfunc(somepa rameter);

Is this possible, or do I need to insert results into a temporary table
and intersect with that?

SELECT some_id
FROM some_table
WHERE ....
INTERSECT
SELECT some_id
FROM temp_result
WHERE temp_id = perlfunc(somepa rameter);

Any pointers would be much appreciated.

Thanks in advance.

Cheers,

Chris

--
Christopher Murtagh
Enterprise Systems Administrator
ISR / Web Communications Group
McGill University
Montreal, Quebec
Canada

Tel.: (514) 398-3122
Fax: (514) 398-2017

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 12 '05 #1
22 3724
On Mon, Nov 10, 2003 at 03:59:53PM -0500, Christopher Murtagh wrote:
I'm trying to write a pl/perl function that will return multiple rows.
I've looked all over the web and only found vague references as to how
to do this (some said it was possible, and some said it wasn't but it
was for older versions of Postgres).


Unfortunately, pl/perl has not been enabled to return multiple rows yet.
Apparently it also can use SPI only through an experimental interface ...
so plperl is pretty much a dead end for you.

Better start learning Tcl ...

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"The ability to monopolize a planet is insignificant
next to the power of the source"

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 12 '05 #2
On Mon, 2003-11-10 at 16:52, Alvaro Herrera wrote:
On Mon, Nov 10, 2003 at 03:59:53PM -0500, Christopher Murtagh wrote:
I'm trying to write a pl/perl function that will return multiple rows.
I've looked all over the web and only found vague references as to how
to do this (some said it was possible, and some said it wasn't but it
was for older versions of Postgres).


Unfortunately, pl/perl has not been enabled to return multiple rows yet.
Apparently it also can use SPI only through an experimental interface ...
so plperl is pretty much a dead end for you.

Better start learning Tcl ...


Thanks for the info. I'm ok with that, I like Perl, but I can live
without it too. :-) Two questions:

1) Can Tcl return multiple rows?

2) Do you know where I can find some sample pl/tcl code? I've found the
postgres docs, but there isn't a lot there.

3) ok, 3 questions... Any word on pl/php and a release date?

Thanks again.

Cheers,

Chris

--
Christopher Murtagh
Enterprise Systems Administrator
ISR / Web Communications Group
McGill University
Montreal, Quebec
Canada

Tel.: (514) 398-3122
Fax: (514) 398-2017

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 12 '05 #3

.

Better start learning Tcl ...

What are we torturing people now? Can plPython do this?

Thanks for the info. I'm ok with that, I like Perl, but I can live
without it too. :-) Two questions:

1) Can Tcl return multiple rows?

2) Do you know where I can find some sample pl/tcl code? I've found the
postgres docs, but there isn't a lot there.

3) ok, 3 questions... Any word on pl/php and a release date?

Thanks again.

Cheers,

Chris


--
Command Prompt, Inc., home of Mammoth PostgreSQL - S/ODBC and S/JDBC
Postgresql support, programming shared hosting and dedicated hosting.
+1-503-222-2783 - jd@commandpromp t.com - http://www.commandprompt.com
Editor-N-Chief - PostgreSQl.Org - http://www.postgresql.org

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 12 '05 #4
Christopher Murtagh wrote:
On Mon, 2003-11-10 at 16:52, Alvaro Herrera wrote:
Better start learning Tcl ...


Thanks for the info. I'm ok with that, I like Perl, but I can live
without it too. :-) Two questions:

1) Can Tcl return multiple rows?
3) ok, 3 questions... Any word on pl/php and a release date?

AFAIK, the only PLs that support returning multiple rows at the moment
are SQL, PL/pgSQL, and PL/R.

Joe


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 12 '05 #5
On Mon, Nov 10, 2003 at 03:00:34PM -0800, Joshua D. Drake wrote:
Better start learning Tcl ...
What are we torturing people now? Can plPython do this?


Well, aparently Tcl is not up to the task either, nor is plPython. At
least I can find no mention on the docs nor the source code. Can your
plPHP or plPerl do it?

It seems the only choices left are PL/pgSQL and C ...

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Acepta los honores y aplausos y perderás tu libertad"

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 12 '05 #6
Well, aparently Tcl is not up to the task either, nor is plPython. At
least I can find no mention on the docs nor the source code. Can your
plPHP or plPerl do it?
I know the plPHP can't yet. The plPerl probably can't either. On the list
for 1.2 of both of those is native SPI and multiple rows.

J
It seems the only choices left are PL/pgSQL and C ...


--
Command Prompt, Inc., home of Mammoth PostgreSQL - S/ODBC and S/JDBC
Postgresql support, programming shared hosting and dedicated hosting.
+1-503-222-2783 - jd@commandpromp t.com - http://www.commandprompt.com
Editor-N-Chief - PostgreSQl.Org - http://www.postgresql.org

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 12 '05 #7
Ben
Sorry, I'm coming into this thread late so I must have missed something...
what's wrong with pl/pgsql?

On Mon, 10 Nov 2003, Alvaro Herrera wrote:
On Mon, Nov 10, 2003 at 03:00:34PM -0800, Joshua D. Drake wrote:
>Better start learning Tcl ...

What are we torturing people now? Can plPython do this?


Well, aparently Tcl is not up to the task either, nor is plPython. At
least I can find no mention on the docs nor the source code. Can your
plPHP or plPerl do it?

It seems the only choices left are PL/pgSQL and C ...

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Acepta los honores y aplausos y perderás tu libertad"

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postg resql.org so that your
message can get through to the mailing list cleanly

Nov 12 '05 #8


Ben wrote:
Sorry, I'm coming into this thread late so I must have missed something...
what's wrong with pl/pgsql?

The fact that it is pl/pgSQL? Seriously though, I think that pl/pgSQL is
counter
intuitive to some people and those of us who are coming from say a Perl
background are going to be much more proficient in using pl/Perl then having
to learn YET another language.

Sincerely,

Joshua Drake
On Mon, 10 Nov 2003, Alvaro Herrera wrote:
On Mon, Nov 10, 2003 at 03:00:34PM -0800, Joshua D. Drake wrote:
>Better start learning Tcl ...
>
>
What are we torturing people now? Can plPython do this?

Well, aparently Tcl is not up to the task either, nor is plPython. At
least I can find no mention on the docs nor the source code. Can your
plPHP or plPerl do it?

It seems the only choices left are PL/pgSQL and C ...

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Acepta los honores y aplausos y perderás tu libertad"

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postg resql.org so that your
message can get through to the mailing list cleanly


--
Command Prompt, Inc., home of Mammoth PostgreSQL - S/ODBC and S/JDBC
Postgresql support, programming shared hosting and dedicated hosting.
+1-503-222-2783 - jd@commandpromp t.com - http://www.commandprompt.com
Editor-N-Chief - PostgreSQl.Org - http://www.postgresql.org

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postg resql.org so that your
message can get through to the mailing list cleanly

Nov 12 '05 #9
Ben
Oh, well yeah, of course there's always that. :)

But once the original poster said "better start learning Tcl" the
commitment had already been made to learn something new. So why not just
go straight for pl/pgsql? Granted, it's got a learning curve, but I find
it a lot easier to tinker with than C functions when you don't know what
you're doing.

On Mon, 2003-11-10 at 18:11, Joshua D. Drake wrote:
Ben wrote:
Sorry, I'm coming into this thread late so I must have missed something...
what's wrong with pl/pgsql?

The fact that it is pl/pgSQL? Seriously though, I think that pl/pgSQL is
counter
intuitive to some people and those of us who are coming from say a Perl
background are going to be much more proficient in using pl/Perl then having
to learn YET another language.

Sincerely,

Joshua Drake
On Mon, 10 Nov 2003, Alvaro Herrera wrote:
On Mon, Nov 10, 2003 at 03:00:34PM -0800, Joshua D. Drake wrote:

>>Better start learning Tcl ...
>>
>>
What are we torturing people now? Can plPython do this?
Well, aparently Tcl is not up to the task either, nor is plPython. At
least I can find no mention on the docs nor the source code. Can your
plPHP or plPerl do it?

It seems the only choices left are PL/pgSQL and C ...

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Acepta los honores y aplausos y perderás tu libertad"

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postg resql.org so that your
message can get through to the mailing list cleanly

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 12 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2213
by: dohnut | last post by:
Here's one for some bored problem solver :) I ran across this earlier today and fixed it, but don't exactly know why. (that usually only happens in C :) I'm using Perl version 5.8.0 btw. Ok, let's start here: I end up with an array that comes from a fetchrow_array() call to MySQL. I return the array to a function.
3
10774
by: Shuaib | last post by:
Is there any way for Oracle (using standard SQL rather than PL/SQL) to suppress the newline character when returning a list of rows. For example, if I have a table EMP with several records. When I issue the statement: SELECT name FROM emp I would like to get a single row output back comprising the following:
9
10773
by: Rowland Hills | last post by:
I have a table which is returning inconsistent results when I query it! In query analyzer: If I do "SELECT * FROM TABLE_NAME" I get no rows returned. If I do "SELECT COL1, COL2 FROM TABLE_NAME" I get 4 rows returned. In Enterprise manager:
3
7617
by: - | last post by:
I have a country table with code and name columns and create a stored procedure 'get_countries()' but have no idea what is the syntax to return multiple rows. I have searched the newsgroups and understand that the solution is to use cursors. Searching for the mySQL solution is to no avail. Do assist me with the syntaxt.
0
9747
by: Kirt Loki Dankmyer | last post by:
So, I download the latest "stable" tar for perl (5.8.7) and try to compile it on the Solaris 8 (SPARC) box that I administrate. I try all sorts of different switches, but I can't get it to compile. I need it to be compiled with threads. Anyone have any wisdom on how best to do this? Here's a transcript of my latest attempt. It's long; you might want to skip to the bottom, where I try "make" and the fatal errors start happening.
13
2556
by: Karl Groves | last post by:
I'm missing something very obvious, but it is getting late and I've stared at it too long. TIA for responses I am writing a basic function (listed at the bottom of this post) that returns data from a query into an array. The intent is that the following code:
1
4115
by: hansoffate | last post by:
Hi, The first part of my script works fine. Basically, the script reads a file with IDs that I want to search from a Flatdatabase and pull information. I setup the a TILDA Delimitted File and then I setup the two Tab Delimitted Files. Located Here: ftp://genome-ftp.stanford.edu/pub/yeast/data_download/chromosomal_feature/SGD_features.tab ...
10
6976
by: happyse27 | last post by:
Hi All, I got this apache errors(see section A1 and A2 below) when I used a html(see section b below) to activate acctman.pl(see section c below). Section D below is part of the configuration of section c. Not sure where went wrong as the web page displayed internal server error. Also, what is the error 543? and error 2114. Where to find the list of errors in websites as it is not the standard apache error. I could not find...
0
10104
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8934
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7460
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6715
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.