Re: Passing arguments to views

From: Mark Dilger <pgsql(at)markdilger(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Passing arguments to views
Date: 2006-02-03 19:08:22
Message-ID: 43E3AA26.5040106@markdilger.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Mark Dilger <pgsql(at)markdilger(dot)com> writes:
>
>>If we are talking about inserting the function definition into the
>>query as a subquery and then letting the parser treat it as a
>>subquery, then I see no reason to use either the existing function or
>>view subsystems. It sounds more like we are discussing a macro
>>language.
>
>
> Which is pretty much what a SQL function is already. I don't see a need
> to invent a separate concept. To the extent that macros have different
> semantics than functions (eg, multiple evaluation of arguments) the
> differences are generally not improvements IMHO ...
>
> regards, tom lane

I have numerous times run EXPLAIN ANALYZE on my queries with SQL functions
embedded and gotten different (far worse) results than if I manually inline the
function following the macro expansion idea above. That has led me to wish that
postgres would inline it for me. That doesn't prove that the macro idea is
needed; it might be that the SQL function systems needs more work. (In fact, I
haven't done this since 8.0.3, so I'm not sure that 8.1 even does a bad job
anymore.)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeremy Drake 2006-02-03 19:12:31 Re: Multiple logical databases
Previous Message Josh Berkus 2006-02-03 19:07:12 Re: Function Stats WAS: Passing arguments to views