Re: Tables as function arguments - Mailing list pgsql-general

From Richard Huxton
Subject Re: Tables as function arguments
Date
Msg-id 200403261612.59850.dev@archonet.com
Whole thread Raw
In response to Tables as function arguments  (Jeremy Semeiks <jrs@denny.farviolet.com>)
List pgsql-general
On Wednesday 24 March 2004 04:31, Jeremy Semeiks wrote:
> Hello,
>
> I use psql interactively for data exploration, and often I want to do
> the same types of generic set operations on data in many different
> tables. For example, to calculate a similarity metric between 2
> different tables I might type:
[snip]
> ... plpy.execute("select * from "+args[0]+" union select * from "+args[1])
> ...
>
> But calling this function on the results of subselects turns into a
> big syntactic mess. Is there a better way to do this kind of thing?

Not really - you might be able to use some sprintf() equivalent to make the
syntax prettier (or different, anyway) but you'll need to build a dynamic
query.

--
  Richard Huxton
  Archonet Ltd

pgsql-general by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: prob with really simple insert
Next
From: Bruce Momjian
Date:
Subject: Re: CREATE TEMP TABLE