Skip site navigation (1) Skip section navigation (2)

Re: pre-MED

From: David Fetter <david(at)fetter(dot)org>
To: PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pre-MED
Date: 2008-10-31 14:48:55
Message-ID: 20081031144852.GF15545@fetter.org (view raw or flat)
Thread:
Lists: pgsql-hackers
On Wed, Oct 29, 2008 at 09:40:00AM -0700, David Fetter wrote:
> Folks,
> 
> Please find enclosed a WIP patch to add the ability for functions to
> see the qualifiers of the query in which they're called.  It's not
> working just yet, and I'm not sure how best to get it working, but I'd
> like to see this as part of 8.4, as SQL/MED is just way too ambitious
> given the time frame.
> 
> Any tips, hints, pointers, etc. would be much appreciated.
> 
> Also, PL/Perl shouldn't be the only language to have this capability.
> How might we add similar capabilities to PL/PythonU and PL/Tcl?  To
> the rest of the PLs?  Would it make any sense to have it in SQL
> language functions?

Please find attached a patch which works in PL/Perl, the work having
been done by Andrew (RhodiumToad) Gierth.  It's not clear to me how
this would be generally surface-able to SQL, though.  Any ideas?

CREATE OR REPLACE FUNCTION show_qual()
RETURNS TEXT
LANGUAGE plperl
AS $$
return $_QUAL->{qual_string};
$$;

postgres=# SELECT * FROM show_qual() s(a) where a like '%';
a
------------------
(a ~~ '%'::text)

However, there are little lacunæ like this:

SELECT * FROM show_qual() s(a)
WHERE A NOT IN (
    SELECT 'foo' UNION ALL SELECT 'bar'
);
a
------------------------
(NOT (hashed subplan))

Cheers,
David.
-- 
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david(dot)fetter(at)gmail(dot)com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

In response to

  • pre-MED at 2008-10-29 16:40:00 from David Fetter

Responses

pgsql-hackers by date

Next:From: Nikhil SontakkeDate: 2008-10-31 14:50:46
Subject: Re: Fwd: [PATCHES] Auto Partitioning Patch - WIP version 1
Previous:From: Tom LaneDate: 2008-10-31 14:21:59
Subject: Re: PG_PAGE_LAYOUT_VERSION 5 - time for change

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group