Re: [GENERAL] uuids with btree_gist

2013-09-03 Thread Joe Van Dyk
On Tue, Sep 3, 2013 at 1:41 PM, Martin Renters wrote: > I'm trying to use timestamp ranges to keep track of the values particular > items had over time, but I'm unable to create a table as follows: > > test=# create extension btree_gist; > CREATE EXTENSION > test=# create table v(item uuid, lifet

Re: [GENERAL] store multiple rows with the SELECT INTO statement

2013-09-03 Thread Adrian Klaver
On 09/03/2013 04:34 PM, Janek Sendrowski wrote: A loop through every input sentence FOR i IN 1..array_length(p_sentence, 1) LOOP FOR some_rec IN EXECUTE "SELECT * FROM table WHERE "Fulltextsearch statement" LOOP "Insert the current record data into the temp table" END LOOP; END

Re: [GENERAL] Generic function for partitioning function?

2013-09-03 Thread Jeff Janes
On Tuesday, September 3, 2013, Gregory Haase wrote: > I am working on a date-based partitioning framework and I would really > like to have a single function that could be used as trigger for any table > that needs to be partitioned by day. I am working in a rails environment, > so every table has

Re: [GENERAL] store multiple rows with the SELECT INTO statement

2013-09-03 Thread Adrian Klaver
On 09/03/2013 04:34 PM, Janek Sendrowski wrote: A loop through every input sentence FOR i IN 1..array_length(p_sentence, 1) LOOP FOR some_rec IN EXECUTE "SELECT * FROM table WHERE "Fulltextsearch statement" LOOP "Insert the current record data into the temp table" END LOOP; END

[GENERAL] Generic function for partitioning function?

2013-09-03 Thread Gregory Haase
I am working on a date-based partitioning framework and I would really like to have a single function that could be used as trigger for any table that needs to be partitioned by day. I am working in a rails environment, so every table has a created_at datetime field. I created my generic function:

Re: [GENERAL] Call for design: PostgreSQL mugs

2013-09-03 Thread Peter Geoghegan
On Tue, Sep 3, 2013 at 3:08 PM, Andreas 'ads' Scherbaum wrote: > We are looking for the next big thing. Actually, it's a bit smaller: a new > design for mugs. So far we had big blue elephants, small blue elephants, > frosty elephants, white SQL code on black mugs ... Now it's time to design > some

Re: [GENERAL] store multiple rows with the SELECT INTO statement

2013-09-03 Thread Adrian Klaver
On 09/03/2013 02:52 PM, Janek Sendrowski wrote: The links don't work. I don't know why. how just don't know how to insert the data of a record in a table The link I sent points to 39.6.4. Looping Through Query Results in the plpgsql documentation: http://www.postgresql.org/docs/9.2/interacti

Re: [GENERAL] store multiple rows with the SELECT INTO statement

2013-09-03 Thread Janek Sendrowski
The links don't work. I don't know why. how just don't know how to insert the data of a record in a table

[GENERAL] Call for design: PostgreSQL mugs

2013-09-03 Thread Andreas 'ads' Scherbaum
PostgreSQL folks! We are looking for the next big thing. Actually, it's a bit smaller: a new design for mugs. So far we had big blue elephants, small blue elephants, frosty elephants, white SQL code on black mugs ... Now it's time to design something new. What's in for you? Fame, of course

Re: [GENERAL] ALTER TABLE transaction isolation problem

2013-09-03 Thread David Johnston
Tom Lane-2 wrote >> Why don't we rewrite tuples with their existing xid in such cases? >> The current state of affairs seem to me to be a pretty clear bug. > > No, it isn't --- the tuple is being modified by the ALTER command. > > regards, tom lane I'm not quite sure what

[GENERAL] uuids with btree_gist

2013-09-03 Thread Martin Renters
I'm trying to use timestamp ranges to keep track of the values particular items had over time, but I'm unable to create a table as follows: test=# create extension btree_gist; CREATE EXTENSION test=# create table v(item uuid, lifetime tstzrange, value text, test(# exclude using gist (item with

Re: [GENERAL] store multiple rows with the SELECT INTO statement

2013-09-03 Thread Kevin Grittner
Janek Sendrowski wrote: > I just can't understabd why it's not possible to store multiple > columns returning from a dynamic Select statement which is > executet with EXECUTE into a temporary table. You can: CREATE TEMPORARY TABLE AS SELECT ... http://www.postgresql.org/docs/current/interactiv

Re: [GENERAL] store multiple rows with the SELECT INTO statement

2013-09-03 Thread Adrian Klaver
On 09/03/2013 12:10 PM, Janek Sendrowski wrote: Thanks for the answers. I just can't understabd why it's not possible to store multiple columns returning from a dynamic Select statement which is executet with EXECUTE into a temporary table. If I'm gonna use the LOOP through the SELECT statement,

Re: [GENERAL] store multiple rows with the SELECT INTO statement

2013-09-03 Thread Janek Sendrowski
Thanks for the answers. I just can't understabd why it's not possible to store multiple columns returning from a dynamic Select statement which is executet with EXECUTE into a temporary table. If I'm gonna use the LOOP through the SELECT statement, how can insert the data from the record into the

Re: [GENERAL] How to find out unused indexes?

2013-09-03 Thread Jeff Janes
On Tue, Sep 3, 2013 at 8:48 AM, ascot.m...@gmail.com wrote: > Thanks. > > how about the case as follows? > > idx_scan = 0 and idx_tup_read = 0 and idx_tup_fetch = 0, but > idx_blks_read is not 0 and idx_blks_hit is not 0 > ? Maintaining an unused index still requires its blocks to be read. Chee

Re: [GENERAL] store multiple rows with the SELECT INTO statement

2013-09-03 Thread Kevin Grittner
Pavel Stehule wrote: > PostgreSQL doesn't support a table variables Well, from a relational theory point of view, a variable which stores a relation is what a table *is*.  PostgreSQL attempts to store data for temporary tables in RAM and spill them to disk only as needed.  So IMO the response su

Re: [GENERAL] ALTER TABLE transaction isolation problem

2013-09-03 Thread Kevin Grittner
Kevin Grittner wrote: > Tom Lane wrote: >> Kevin Grittner writes: >>> Why don't we rewrite tuples with their existing xid in such >>> cases?  The current state of affairs seem to me to be a pretty >>> clear bug. >> >> No, it isn't --- the tuple is being modified by the ALTER >> command. > > If a

Re: [GENERAL] How to find out unused indexes?

2013-09-03 Thread ascot.m...@gmail.com
Thanks. how about the case as follows? idx_scan = 0 and idx_tup_read = 0 and idx_tup_fetch = 0, but idx_blks_read is not 0 and idx_blks_hit is not 0 ? regards On 3 Sep 2013, at 5:31 PM, Abdul Sayeed wrote: > Hi, > > Below query can be handy to find unused indexes. > > select indexrelname

Re: [GENERAL] ALTER TABLE transaction isolation problem

2013-09-03 Thread Kevin Grittner
Tom Lane wrote: > Kevin Grittner writes: >> Why don't we rewrite tuples with their existing xid in such >> cases?  The current state of affairs seem to me to be a pretty >> clear bug. > > No, it isn't --- the tuple is being modified by the ALTER > command. If a REPEATABLE READ or SERIALIZABLE tr

Re: [GENERAL] ALTER TABLE transaction isolation problem

2013-09-03 Thread Tom Lane
Kevin Grittner writes: > Why don't we rewrite tuples with their existing xid in such cases? > The current state of affairs seem to me to be a pretty clear bug. No, it isn't --- the tuple is being modified by the ALTER command. regards, tom lane -- Sent via pgsql-gener

[GENERAL] Creating a very simple extension causing: ERROR: could not open file "base/6064585/9440403": No such file or directory

2013-09-03 Thread Robert Nix
I narrowed the issue down to trying to select from a view being created in the same extension, like so: create or replace view av as select 1 as a; create table ax as select * from av; Even just selecting from the view after creating it causes the error so it's the access to the view that's the i

Re: [GENERAL] ALTER TABLE transaction isolation problem

2013-09-03 Thread David Johnston
Kevin Grittner-5 wrote >> [ Examples shows that both SERIALIZABLE and REPEATABLE READ >> transactions could see an empty table which was not empty as of >> the point the snapshot was taken.  For that matter, it was not >> empty at any later point, either. ] > > Why don't we rewrite tuples with the

Re: [GENERAL] ALTER TABLE transaction isolation problem

2013-09-03 Thread Kevin Grittner
DT wrote: > I'm reading code of ALTER TABLE, and I found when target table > needs rewrite, tuple inserted into new heap uses current > transaction's xid as xmin. That sure sounds wrong to me. > Does this behavior satisfy serializable isolation? I wrote some > test cases: > > [ Examples shows

Re: [GENERAL] SSI and predicate locks - a non-trivial use case

2013-09-03 Thread Kevin Grittner
Gianni Ceccarelli wrote: > On 2013-08-31 Kevin Grittner wrote: >> [Locks without PIDs] are predicate locks related to a >> transaction which has been PREPARED (for two-phase commit) or >> committed, but which may still be relevant because there are >> overlapping read-write transactions which ar

Re: [GENERAL] Dump/Reload pg_statistic to cut time from pg_upgrade?

2013-09-03 Thread Bruce Momjian
On Sun, Sep 1, 2013 at 10:35:57AM -0700, Jeff Davis wrote: > [ late response, but might still be useful to someone ] > > You can work around the problem with a little effort if you call > array_in directly. It takes the type output (cstring), element type > (oid), and element typmod (integer). >

Re: [GENERAL] How to find out unused indexes?

2013-09-03 Thread Abdul Sayeed
Hi, Below query can be handy to find unused indexes. select indexrelname from pg_stat_user_indexes where idx_scan = 0 and idx_tup_read = 0 and idx_tup_fetch = 0 ; Hope it helps. Thanks & Regards, Abdul Sayeed EnterpriseDB Corporation - RDBA Team The Postgres Database Company Office: +1-732-