Re: [SQL] Get days between two dates?

2011-01-31 Thread Tovo J. RABEMANANTSOA
On 01/31/2011 04:50 PM, Emi Lu wrote: > Good morning, > > Is there an existing method to get days between two dates? > > For example, > > select '2010-01-01'::date - '1999-10-12'::date > > Returns how many days. > > Thank you, > > -- > Lu Ying > Hi ! Yes there is : date '2001-10-01' - date

Re: [SQL] Get days between two dates?

2011-01-31 Thread Oliveiros d'Azevedo Cristina
That's precisely what I think.. :-| - Original Message - From: "Kenneth Marshall" To: "Emi Lu" Cc: Sent: Monday, January 31, 2011 4:39 PM Subject: Re: [SQL] Get days between two dates? On Mon, Jan 31, 2011 at 10:50:43AM -0500, Emi Lu wrote: Good morning, Is there an existing me

Re: [SQL] Get days between two dates?

2011-01-31 Thread Oliveiros d'Azevedo Cristina
Doesn't the SELECT you indicated do what you need? Best, Oliveiros - Original Message - From: "Emi Lu" To: Sent: Monday, January 31, 2011 3:50 PM Subject: [SQL] Get days between two dates? Good morning, Is there an existing method to get days between two dates? For example, se

Re: [SQL] Get days between two dates?

2011-01-31 Thread Kenneth Marshall
On Mon, Jan 31, 2011 at 10:50:43AM -0500, Emi Lu wrote: > Good morning, > > Is there an existing method to get days between two dates? > > For example, > > select '2010-01-01'::date - '1999-10-12'::date > > Returns how many days. > > Thank you, > > -- > Lu Ying > Didn't you just answer your own qu

Re: [SQL] how to get row number in select query

2011-01-31 Thread Emi Lu
Ok, before 8.4, there I can use row_number(). For 8.3 + display tag + order by integer + paging based on pageBean ArrayList alist; In Bean.java, added: private int rec_num; in main .action java: for(int i=0 ; i Piotr Czekalski, 27.01.2011 16:21: Gentelmen, I follow this thread and I don't

Re: [SQL] Get days between two dates?

2011-01-31 Thread Emi Lu
On 01/31/2011 11:33 AM, Oliveiros d'Azevedo Cristina wrote: Doesn't the SELECT you indicated do what you need? Ok, I figured out: age() + date_part(...) would be able to get it: select date_part('day', age(date1::timestamp, date2::timestamp) ) -- Lu Ying - Original Message - Fro

[SQL] Get days between two dates?

2011-01-31 Thread Emi Lu
Good morning, Is there an existing method to get days between two dates? For example, select '2010-01-01'::date - '1999-10-12'::date Returns how many days. Thank you, -- Lu Ying -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.po

Re: [SQL] aggregation of setof

2011-01-31 Thread Viktor Bojović
maybe custom types can be helpful. i use them when i have to many variables or arrays. On Mon, Jan 31, 2011 at 9:52 AM, Andreas Gaab wrote: > Functions apparently cannot take setof arguments. > > > > Postgres 8.4: > > > > CREATE OR REPLACE FUNCTION testtable(IN setof anyarray) > > RETURNS anya

Re: [SQL] aggregation of setof

2011-01-31 Thread Tom Lane
Andreas Gaab writes: > Could not the function regexp_matches(text, text) be defined to only return a > text[] not a setof text[]? It'd be pretty hard to change at this point, because of backwards-compatibility considerations, and because the two functions share a single implementation.

[SQL] fix uuid contrib module for Windows 64

2011-01-31 Thread Michael Gould
As the subject implies, has this been fixed and is it in a currently released GA build?   Best Regards -- Michael Gould, Managing Partner Intermodal Software Solutions, LLC 904.226.0978 904.592.5250 fax

Re: [SQL] aggregation of setof

2011-01-31 Thread Andreas Gaab
Hi, Could not the function regexp_matches(text, text) be defined to only return a text[] not a setof text[]? Because that is, what it actually does, or? For every input, it returns only one output row. The function regexp_matches(text,text,text) in contrast really can return multiple rows whil

Re: [SQL] aggregation of setof

2011-01-31 Thread Pavel Stehule
Hello use a array constructor instead SELECT ARRAY(SELECT ...) Regards Pavel Stehule 2011/1/31 Andreas Gaab : > Functions apparently cannot take setof arguments. > > > > Postgres 8.4: > > > > CREATE OR REPLACE FUNCTION testtable(IN setof anyarray) > >   RETURNS anyarray AS > > $BODY$ > > SELEC

Re: [SQL] aggregation of setof

2011-01-31 Thread Andreas Gaab
Functions apparently cannot take setof arguments. Postgres 8.4: CREATE OR REPLACE FUNCTION testtable(IN setof anyarray) RETURNS anyarray AS $BODY$ SELECT $1 LIMIT 1; $BODY$ LANGUAGE 'sql' STABLE; --> ERROR: functions cannot accept set arguments Von: Viktor Bojović [mailto:viktor.bojo...@