Re: [SQL] How to loop though an array plpgsql?

2005-07-30 Thread Michael Fuhr
On Fri, Jul 29, 2005 at 03:39:12PM -0800, Matthew Schumacher wrote:
> I need to loop though an input array, but can't figure out how to do it,
> the docs aren't really clear on this.

This comes up from time to time -- search the archives to see past
discussion.  Suggestions usually involve array_lower() and array_upper().

http://archives.postgresql.org/
http://www.postgresql.org/docs/8.0/static/functions-array.html

If you're using integers then see also the int_array_enum() function
in the contrib/intagg module.

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/

---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


Re: [SQL] bug in information_schema?

2005-07-30 Thread Tom Lane
Kyle Bateman <[EMAIL PROTECTED]> writes:
> I noticed that it seemed a bit slow to query 
> information_schema.view_column_usage.   As I look at the code in 
> information_schema.sql, I'm not sure why pg_user is referenced twice 
> (once without an alias).  It looks like we can take out the first 
> pg_user and remove the DISTINCT keyword and this improves the efficiency 
> significantly.

The unconstrained join against pg_user is clearly unnecessary,
and in fact I took it out a few days ago.  I'm not sure whether the
SELECT DISTINCT is still needed --- it might be, if there can be
multiple pg_depend entries linking the same entities.
Peter, any thoughts?

regards, tom lane

---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly