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

Re: LIMITing number of results in a VIEW with global variables

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Thomas Girault <toma(dot)girault(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: LIMITing number of results in a VIEW with global variables
Date: 2011-10-15 10:47:59
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
On Fri, Oct 14, 2011 at 10:43 AM, Thomas Girault <toma(dot)girault(at)gmail(dot)com> wrote:
> I am now trying to limit the number of results in the view according
> to the global value K :
> CREATE OR REPLACE VIEW filtered_employees AS
>    SELECT *, get_mu() as mu
>    FROM employees
>    LIMIT K;

Well, SQL, our our dialect of it anyway, doesn't have global
variables.  So I think the above is going to throw a syntax error.
You may have global variables in your C code, but those won't be
visible from the SQL level.

In general, I think you'd be better off not relying on C global
variables either, and instead passing the values you need as function

Robert Haas
The Enterprise PostgreSQL Company

In response to


pgsql-hackers by date

Next:From: Robert HaasDate: 2011-10-15 10:49:43
Subject: Re: Call stacks and RAISE INFO
Previous:From: Nathan BoleyDate: 2011-10-15 10:47:16
Subject: Re: WIP: collect frequency statistics for arrays

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