From: Marc Wrubleski <mlwruble@math.ucalgary.ca>
To: KÖPFERL Robert <robert.koepferl@sonorys.at>
Cc: pgsql-sql@postgresql.org
Cc: pgsql-committers@postgresql.org
Subject: Re: [SQL] Returning a Cross Tab record set from a function
Date: Thu, 16 Jun 2005 11:16:26 -0600
Message-ID: <1118942186.30032.44.camel@linuxtest.math.ucalgary.ca> (raw)
In-Reply-To: <ED4E30DD9C43D5118DFB00508BBBA76EB16742@neptun.sonorys.at>
References: <ED4E30DD9C43D5118DFB00508BBBA76EB16742@neptun.sonorys.at>
Hi All, thanks for your responses.
I know higher level languages can perform the operation, but I think a
function written in a higher level language could still not return a
resulting (structure undefined) table back as a result set. I hope I am
wrong about this ;-) If not, read on...
My function caller cannot query like SELECT * FROM crosstab ('SELECT
x,y,z FROM foo ...') AS ct(a int, b text, c text) because he does not
know that x,y,or z are available to him, and there may also q,r, and s
too. That's part of what he is hoping to get from the query! (as well as
the data for these columns)
Instead I need to query like SELECT * FROM crosstab_undef ('SELECT *
FROM foo' ...)
I am no programmer, so I need someone to tell me if it is possible to
add this feature to Postgres, or does it go against every (type) rule
written? The difference is that if it IS possible, I may be able to get
someone to write some code to contribute. I would love to hear from a
developer on this one.
I have a system that has two interfaces to the database (More if you
include reporting tools) and I would like similar functionality for all
interfaces. This is why I would like to have a function defined at the
database level.
Many Thanks,
Marc Wrubleski
On Mon, 2005-06-06 at 12:20 +0200, KÖPFERL Robert wrote:
>
> |-----Original Message-----
> |From: Marc Wrubleski [mailto:mlwruble@math.ucalgary.ca]
> |Sent: Mittwoch, 01. Juni 2005 16:15
> |To: pgsql-sql@postgresql.org
> |Subject: [SQL] Returning a Cross Tab record set from a function
> |
> [...]
> |
> |It seems I can do this from any higher level language, but it drives me
> |crazy that I can't perform this operation as a function inside of
> |Postgres...
>
> Yes, semms very like this can't be done in just sql but needs a higher level
> lng.
> Actually Postgres provides such higher languages. Try including PL/Python
> PL/perl or PL/tk. Fom there you are able to query all the metadata of the
> wanted tables so that a adequate SQL-string can be generated.
>
> In case of sourcecode, you find theses languages in the contrib dir
> |
> |Thanks for any thoughts you might have...
> |
> |--
> |Marc Wrubleski <mlwruble_at_math.ucalgary.ca>
> |
> |
> |---------------------------(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
> |
--
Marc Wrubleski <mlwruble@math.ucalgary.ca>
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: mlwruble@math.ucalgary.ca, robert.koepferl@sonorys.at, pgsql-committers@postgresql.org
Subject: Re: [SQL] Returning a Cross Tab record set from a function
In-Reply-To: <1118942186.30032.44.camel@linuxtest.math.ucalgary.ca>
* 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