[GENERAL] how to make an SQL UPDATE from record returning function

2012-04-24 Thread Rafal Pietrak
Hi all, Recently I have fell onto a multicolumn update problem, earlier discussed here: http://postgresql.1045698.n5.nabble.com/UPDATE-of-several-columns-using-SELECT-statement-td1916045.html But in my case, subselect does not help, since in my case, new values for a row I get from an output of

Re: [GENERAL] how to make an SQL UPDATE from record returning function

2012-04-24 Thread Abel Abraham Camarillo Ojeda
On Tue, Apr 24, 2012 at 2:02 AM, Rafal Pietrak wrote: > Hi all, > > Recently I have fell onto a multicolumn update problem, earlier > discussed here: > > http://postgresql.1045698.n5.nabble.com/UPDATE-of-several-columns-using-SELECT-statement-td1916045.html > > But in my case, subselect does not h

[GENERAL] Re: [HACKERS] Namespace of array of user defined types is confused by the parser in insert?

2012-04-24 Thread Krzysztof Nienartowicz
> pgsql-general probably would be best. -hackers is for discussion of internals > and development, not for usage questions. ok, thank you. > > [types have namespaces] > > >> Is there any way of avoid this error different than having a single >> type defined for all schemas? >> Any hints apprecia

Re: [GENERAL] how to make an SQL UPDATE from record returning function

2012-04-24 Thread Rafal Pietrak
On Tue, 2012-04-24 at 02:48 -0500, Abel Abraham Camarillo Ojeda wrote: [] > > Why don't create table my_table which stores the composite value by itself > (not > in two parts)? Hmmm. OK. mea coulpa. I didn't follow the SQL good practice, and I don't have a unique ID column in

Re: [GENERAL] how to make an SQL UPDATE from record returning function

2012-04-24 Thread Thomas Kellerer
Rafal Pietrak, 24.04.2012 09:02: Hi all, Recently I have fell onto a multicolumn update problem, earlier discussed here: http://postgresql.1045698.n5.nabble.com/UPDATE-of-several-columns-using-SELECT-statement-td1916045.html But in my case, subselect does not help, since in my case, new values

[GENERAL] Re: [HACKERS] Namespace of array of user defined types is confused by the parser in insert?

2012-04-24 Thread Andrew Dunstan
On 04/24/2012 05:12 AM, Krzysztof Nienartowicz wrote: These types are qualified when created - the error does not happen on creation - there are two types in two different namespaces - it happens only on insert where it is not possible to qualify the type's namespace. It looks like a bug in th

[GENERAL] Simple way to get missing number

2012-04-24 Thread Emi Lu
Good morning, May I know is there a simple sql command which could return missing numbers please? For example, t1(id integer) values= 1, 2, 3 500 select miss_num(id) from t1 ; Will return: === 37, 800, 8001 Thanks a lot! Emi -- Sent via pgsql-general mailing list

Re: [GENERAL] Simple way to get missing number

2012-04-24 Thread hubert depesz lubaczewski
On Tue, Apr 24, 2012 at 10:15:26AM -0400, Emi Lu wrote: > May I know is there a simple sql command which could return missing > numbers please? > For example, > t1(id integer) > values= 1, 2, 3 500 > select miss_num(id) > from t1 ; select generate_series( (select min(id) from t1), (sele

Re: [GENERAL] Simple way to get missing number

2012-04-24 Thread Alban Hertroys
On 24 April 2012 16:15, Emi Lu wrote: > Good morning, > > May I know is there a simple sql command which could return missing numbers > please? > > For example, > > t1(id integer) > > values= 1, 2, 3 500 > > select miss_num(id) > from   t1 ; > > > Will return: > === > 37, 800,

[GENERAL] Fractions of seconds in timestamps

2012-04-24 Thread rihad
As PostgreSQL stores timestamps with a fractional part, does it mean that WHERE f BETWEEN '2012-04-23 00:00:00' AND '2012'04-23 23:59:59' might miss records with values of f equal to 23:59:59.1234 or so? -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to you

Re: [GENERAL] Fractions of seconds in timestamps

2012-04-24 Thread Chris Angelico
On Wed, Apr 25, 2012 at 12:51 AM, rihad wrote: > As PostgreSQL stores timestamps with a fractional part, does it mean that > WHERE f BETWEEN '2012-04-23 00:00:00' AND '2012'04-23 23:59:59' might miss > records with values of f equal to 23:59:59.1234 or so? I think so. I would recommend either usi

[GENERAL] how robust are custom dumps?

2012-04-24 Thread Willy-Bas Loos
Hi, Some 6 years ago, i had a bad experience with a custom dump. It wouldn't restore and my data was lost. I was a beginner then, and working under windows, and i wasn't on the mailing list yet. It was no critical data, we could build the database again, which was then easier than figuring out wha

Re: [GENERAL] Fractions of seconds in timestamps

2012-04-24 Thread rihad
On 04/24/2012 07:51 PM, rihad wrote: As PostgreSQL stores timestamps with a fractional part, does it mean that WHERE f BETWEEN '2012-04-23 00:00:00' AND '2012'04-23 23:59:59' might miss records with values of f equal to 23:59:59.1234 or so? Answering to myself: depends on how timestamp was d

Re: [GENERAL] Simple way to get missing number

2012-04-24 Thread Emi Lu
Aha, generate_series, I got it. Thank you very much!! I also tried left join, it seems that left join explain analyze returns faster comparing with except: select num as missing from generate_series(5000, 22323) t(num) left join t1 on (t.num = t1.id) where t1.id is null limit 10; Emi On

Re: [GENERAL] how robust are custom dumps?

2012-04-24 Thread Andreas Kretschmer
Willy-Bas Loos wrote: > Hi, > > Some 6 years ago, i had a bad experience with a custom dump. It wouldn't > restore and my data was lost. > I was a beginner then, and working under windows, and i wasn't on the mailing > list yet. > It was no critical data, we could build the database again, which

Re: [GENERAL] [SQL] Simple way to get missing number

2012-04-24 Thread Steve Crawford
On 04/24/2012 07:15 AM, Emi Lu wrote: Good morning, May I know is there a simple sql command which could return missing numbers please? For example, t1(id integer) values= 1, 2, 3 500 select miss_num(id) from t1 ; Will return: === 37, 800, 8001 T select generate

[GENERAL] how to group by similarity ?

2012-04-24 Thread Andreas
Hi, I'm trying to get an idea about pg_trgrm. I created a GIST index on a text column in a table. Now I can filter the table with similarity(). How would I group the table so that it shows groups that have similarity () > x ? Lets say the table looks like this: id, txt 1, aa1 2, bb1 3,

Re: [GENERAL] [SQL] Simple way to get missing number

2012-04-24 Thread Emi Lu
I got it and thank you very much for everyone's help!! It seems that "left join where is null" is faster comparing with "except". And my final query is: select num as missing from generate_series(5000, #{max_id}) t(num) left join t1 on (t.num = t1.id) where t1.id is null; Emi On 04/24/201

Re: [GENERAL] pg_basebackup issues

2012-04-24 Thread Lonni J Friedman
On Fri, Apr 20, 2012 at 12:31 PM, Magnus Hagander wrote: > On Fri, Apr 20, 2012 at 19:51, Lonni J Friedman wrote: >> Anyway, lesson learned, I need to either invoke pg_basebackup as the >> same user that runs the database (or is specified with the -U >> parameter ?), or write the backup somewhere

Re: [GENERAL] [SQL] Simple way to get missing number

2012-04-24 Thread Steve Crawford
On 04/24/2012 11:10 AM, Emi Lu wrote: I got it and thank you very much for everyone's help!! It seems that "left join where is null" is faster comparing with "except". And my final query is: select num as missing from generate_series(5000, #{max_id}) t(num) left join t1 on (t.num = t1.id)

Re: [GENERAL] how robust are custom dumps?

2012-04-24 Thread Vick Khera
On Tue, Apr 24, 2012 at 11:17 AM, Willy-Bas Loos wrote: > So my question is: what is your advice on custom dumps? Can i bet my life on > them? Yes, I would and I do. I've never had a failure as you describe, going back all the way to Postgres 6.5-ish times. Back then I did have full DB corrupti

Re: [GENERAL] how robust are custom dumps?

2012-04-24 Thread Thom Brown
On 24 April 2012 16:17, Willy-Bas Loos wrote: > Hi, > > Some 6 years ago, i had a bad experience with a custom dump. It wouldn't > restore and my data was lost. What was the experience? Is it possible you had specified a compression level without the format set to custom? That would result in a

[GENERAL] Backups using Solaris ZFS Snapshots

2012-04-24 Thread Yunong J Xiao
I am currently backing up my postgres instances using ZFS snapshots instead of the sanctioned pg_dump utility mainly because I am running on Solaris and it offers a copy-on-write file system. Anecdotally this has been working fine for me. Are there any issues I should be aware of since I'm not usin

Re: [GENERAL] Backups using Solaris ZFS Snapshots

2012-04-24 Thread Michael Nolan
On Tue, Apr 24, 2012 at 4:08 PM, Yunong J Xiao wrote: > I am currently backing up my postgres instances using ZFS snapshots > instead of the sanctioned pg_dump utility mainly because I am running on > Solaris and it offers a copy-on-write file system. Anecdotally this has > been working fine for

[GENERAL] Bug? Query plans / EXPLAIN using gigabytes of memory

2012-04-24 Thread Toby Corkindale
Hi, I'm hitting some peculiar behaviour. I'm currently on Pg 9.1.3 on a 64bit Debian system. I have a database which is moderately large - 20 GByte or so - and contains that data split up over dozens of tables, which are themselves partitioned. Queries are usually only run against fairly small,