Re: [SQL] proposal for a CookBook in postgresql.org

2009-06-02 Thread Bruce Momjian
Alvaro Herrera wrote:
> Pavel Stehule escribi?:
> > 2009/5/18 Alvaro Herrera :
> > > Pavel Stehule escribi?:
> > >
> > >> others tricks http://www.postgres.cz/index.php/PostgreSQL_SQL_Tricks
> > >
> > > There's a lot of good stuff in there ... would you care about
> > > copying/moving it to wiki.postgresql.org/wiki/Snippets ?
> > 
> > This contents is free - and if you would do it, please do it. My
> > english isn't good, so it's work for someone with good english. I am
> > maintainer and founder of this site, and I am granting rights for free
> > content copy.
> 
> I don't have time for that right now, but I have added a link to your
> page at the top of Snippets.  Thanks.

FYI, I have a copy of the old plpgsql cookbook at:

http://www.brasileiro.net:8080/postgres/cookbook/
PostgreSQL CookBook Pages
Roberto Mello

http://techdocs.postgresql.org/guides/SetReturningFunctions
PostgreSQL 7.3 Set Returning Functions
Stephan Szabo

stored at:

http://momjian.us/expire/cookbook.tgz

if someone wants to transfer them to the wiki.

-- 
  Bruce Momjian  http://momjian.us
  EnterpriseDB http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


Re: [SQL] proposal for a CookBook in postgresql.org

2009-06-02 Thread Alvaro Herrera
Bruce Momjian escribió:

> FYI, I have a copy of the old plpgsql cookbook at:
> 
>   http://www.brasileiro.net:8080/postgres/cookbook/
>   PostgreSQL CookBook Pages
>   Roberto Mello
>   
>   http://techdocs.postgresql.org/guides/SetReturningFunctions
>   PostgreSQL 7.3 Set Returning Functions
>   Stephan Szabo

Stephan's article is already on the wiki:
http://wiki.postgresql.org/wiki/Return_more_than_one_row_of_data_from_PL/pgSQL_functions
It needs an update.

I don't know about Roberto Mello's site.  Did we get a copyright
transfer or a license saying we could use the contents?

-- 
Alvaro Herrerahttp://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


Re: [SQL] proposal for a CookBook in postgresql.org

2009-06-02 Thread Bruce Momjian
Alvaro Herrera wrote:
> Bruce Momjian escribi?:
> 
> > FYI, I have a copy of the old plpgsql cookbook at:
> > 
> > http://www.brasileiro.net:8080/postgres/cookbook/
> > PostgreSQL CookBook Pages
> > Roberto Mello
> > 
> > http://techdocs.postgresql.org/guides/SetReturningFunctions
> > PostgreSQL 7.3 Set Returning Functions
> > Stephan Szabo
> 
> Stephan's article is already on the wiki:
> http://wiki.postgresql.org/wiki/Return_more_than_one_row_of_data_from_PL/pgSQL_functions
> It needs an update.
> 
> I don't know about Roberto Mello's site.  Did we get a copyright
> transfer or a license saying we could use the contents?

Nope, but I assumed it was BSD-licensed.  I see this Josh Berkus
copyright:

--Copyright Josh Berkus, j...@agliodbs.com
--permission granted to use anywhere provided that this
--copyright statement remains in the code.
--No warranty is given or implied.
--Use at your own risk -- strictly beta code.

-- 
  Bruce Momjian  http://momjian.us
  EnterpriseDB http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


Re: [DOCS] [SQL] proposal for a CookBook in postgresql.org

2009-06-02 Thread Alvaro Herrera
Bruce Momjian escribió:
> Alvaro Herrera wrote:

> > I don't know about Roberto Mello's site.  Did we get a copyright
> > transfer or a license saying we could use the contents?
> 
> Nope, but I assumed it was BSD-licensed.  I see this Josh Berkus
> copyright:
> 
>   --Copyright Josh Berkus, j...@agliodbs.com

You're saying that Josh Berkus owns the copyright of the entire site?
That seems unlikely.

I think the way we should go about this is somebody talks to Roberto and
gets his approval on us using his content on the Wiki (the way we did
with Pavel upthread).  Otherwise I think it's a nonstarter.

-- 
Alvaro Herrerahttp://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


[SQL] complex column definition in query

2009-06-02 Thread Seb
Hi,

Say we have a table:

SELECT * FROM weather;
 city  | temp_lo | temp_hi | prcp  
---+-+-+---
 San Francisco |  46 |  50 | 0.25 
 San Francisco |  43 |  57 |0 
 Hayward   |  37 |  54 |  
 Hayward   |  30 |  58 |  
 Somewhere |  25 |  60 |  
 Somewhere |  28 |  50 |  
(6 rows)

I'm struggling to build a query with a column temp, where the first row
is the lowest temp_lo followed by all the temp_hi for each city.  So
this would be the output:

 city  | temp  
---+--
 San Francisco |   43
 San Francisco |   50 
 San Francisco |   57 
 Hayward   |   30
 Hayward   |   54 
 Hayward   |   58 
 Somewhere |   25
 Somewhere |   60 
 Somewhere |   50 
(6 rows)

Any ideas appreciated!  Thanks.


Cheers,

-- 
Seb


-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


Re: [DOCS] [SQL] proposal for a CookBook in postgresql.org

2009-06-02 Thread Bruce Momjian
Alvaro Herrera wrote:
> Bruce Momjian escribi?:
> > Alvaro Herrera wrote:
> 
> > > I don't know about Roberto Mello's site.  Did we get a copyright
> > > transfer or a license saying we could use the contents?
> > 
> > Nope, but I assumed it was BSD-licensed.  I see this Josh Berkus
> > copyright:
> > 
> > --Copyright Josh Berkus, j...@agliodbs.com
> 
> You're saying that Josh Berkus owns the copyright of the entire site?
> That seems unlikely.

On one function.

> I think the way we should go about this is somebody talks to Roberto and
> gets his approval on us using his content on the Wiki (the way we did
> with Pavel upthread).  Otherwise I think it's a nonstarter.

OK.

-- 
  Bruce Momjian  http://momjian.us
  EnterpriseDB http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql