Re: [GENERAL] [RFE] auto ORDER BY for SELECT

2012-01-24 Thread Chris Angelico
On Mon, Jan 23, 2012 at 11:17 PM, Douglas Eric sekk...@hotmail.com wrote: I suggest to change this behavior. If one makes a SELECT statement without any ORDER BY, it would be clever to automatically sort by the first primary key found in the query, if any. The present behavior would still be

Re: [GENERAL] Incomplete startup packet help needed

2012-01-24 Thread Florian Weimer
* David Johnston: Immediately upon starting the server I get an incomplete startup packet log message. Just prior there is an autovacuum launcher started message. Like this? 2012-01-23 10:42:55.245 UTC 11545 LOG: database system is ready to accept connections 2012-01-23 10:42:55.245 UTC

Re: [GENERAL] [RFE] auto ORDER BY for SELECT

2012-01-24 Thread Alban Hertroys
On 24 January 2012 09:29, Chris Angelico ros...@gmail.com wrote: On Mon, Jan 23, 2012 at 11:17 PM, Douglas Eric sekk...@hotmail.com wrote: I suggest to change this behavior. If one makes a SELECT statement without any ORDER BY, it would be clever to automatically sort by the first primary key

Re: [GENERAL] Best way to create unique primary keys across schemas?

2012-01-24 Thread panam
Chris Angelico wrote You can share a sequence object between several tables. This can happen somewhat unexpectedly, as I found out to my surprise a while ago: CREATE TABLE tbl1 (ID serial primary key,foo varchar,bar varchar); INSERT INTO tbl1 (foo,bar) VALUES ('asdf','qwer'); CREATE

[GENERAL] I cant create excluding constaint

2012-01-24 Thread pasman pasmański
Hi. I have a table with two columns: create table GroupsOfOrders ( Orders text[]; -- a set of identifiers Period cube; -- a period of time for all identifiers in field Orders ); How to create excluding constraint, which prevent overlapping Period for all orders in a field Orders ?

[GENERAL] left join with OR optimization

2012-01-24 Thread Sim Zacks
I've seen written that a b-tree index can't be used on a join with an OR. Is there a way to optimize a join so that it can use an index for a query such as: select a.partid,a.duedate,coalesce(a.quantity,0)+sum(coalesce(b.quantity,0)) from stat_allocated_components a left join

Re: [GENERAL] I cant create excluding constaint

2012-01-24 Thread Andreas Kretschmer
pasman pasmański pasma...@gmail.com wrote: Hi. I have a table with two columns: create table GroupsOfOrders ( Orders text[]; -- a set of identifiers Period cube; -- a period of time for all identifiers in field Orders ); How to create excluding constraint, which prevent

Re: [GENERAL] I cant create excluding constaint

2012-01-24 Thread hubert depesz lubaczewski
On Tue, Jan 24, 2012 at 12:41:28PM +0100, pasman pasmański wrote: Hi. I have a table with two columns: create table GroupsOfOrders ( Orders text[]; -- a set of identifiers Period cube; -- a period of time for all identifiers in field Orders ); How to create excluding constraint,

Re: [GENERAL] PG 9.0 EBS Snapshot Backups on Slave

2012-01-24 Thread Robert Treat
On Mon, Jan 23, 2012 at 8:02 PM, Alan Hodgson ahodg...@simkin.ca wrote: On Monday, January 23, 2012 07:54:16 PM Andrew Hannon wrote: It is worth noting that, the slave (seemingly) catches up eventually, recovering later log files with streaming replication current. Can I trust this state?

Re: [GENERAL] left join with OR optimization

2012-01-24 Thread David Johnston
What version of PostgreSQL? On Jan 24, 2012, at 9:28, Sim Zacks s...@compulab.co.il wrote: I've seen written that a b-tree index can't be used on a join with an OR. Is there a way to optimize a join so that it can use an index for a query such as: select

Re: [GENERAL] left join with OR optimization

2012-01-24 Thread Tom Lane
Sim Zacks s...@compulab.co.il writes: I've seen written that a b-tree index can't be used on a join with an OR. That's not the case ... Is there a way to optimize a join so that it can use an index for a query such as: select

Re: [GENERAL] Best way to create unique primary keys across schemas?

2012-01-24 Thread Chris Angelico
On Tue, Jan 24, 2012 at 10:23 PM, panam pa...@gmx.net wrote: Wow, this is pretty useful. Just to fit it more to my original use case, I used this: CREATE TABLE tbl (ID serial primary key,foo varchar,bar varchar);  --in public schema CREATE TABLE schema1.tbl (LIKE public.tbl INCLUDING ALL);  

Re: [GENERAL] update with from

2012-01-24 Thread Adrian Klaver
On Monday, January 23, 2012 10:11:00 pm Sim Zacks wrote: On 01/23/2012 07:10 PM, Adrian Klaver wrote: On Monday, January 23, 2012 7:32:35 am Sim Zacks wrote: On 01/23/2012 05:13 PM, Adrian Klaver wrote: When I throw in code to make the select only return the correct rows The select

[GENERAL] Document routing workflow database design

2012-01-24 Thread jonesd
I'm looking at a database design for tracking the movement/routing of documents through a workflow using PostgreSQL (version 9.1). Basically, I have a state diagram for the possible routings and came up with two different designs for how to implement the tables. As a quick advance note,

Re: [GENERAL] Best way to create unique primary keys across schemas?

2012-01-24 Thread panam
Chris Angelico wrote I would recommend using an explicit sequence object rather than relying on odd behavior like this; for instance, if you now drop public.tbl, the sequence will be dropped too. However, what you have there is going to be pretty close to the same result anyway. Oops,

Re: [GENERAL] Best way to create unique primary keys across schemas?

2012-01-24 Thread Merlin Moncure
On Tue, Jan 24, 2012 at 5:23 AM, panam pa...@gmx.net wrote: Wow, this is pretty useful. Just to fit it more to my original use case, I used this: CREATE schema schema1; CREATE schema schema2; CREATE TABLE tbl (ID serial primary key,foo varchar,bar varchar);  --in public schema CREATE TABLE

[GENERAL] any plans to support more rounding methods in sql?

2012-01-24 Thread raf
hi, i just needed to round some numbers down to 4 decimal places but a quick search indicated that postgresql doesn't support all of the rounding methods so i had to write this dreadful function: create or replace function round_down_to_4_decimal_places(amount decimal(12,6)) returns

Re: [GENERAL] Best way to create unique primary keys across schemas?

2012-01-24 Thread Rob Sargent
On 01/24/2012 04:23 PM, Merlin Moncure wrote: On Tue, Jan 24, 2012 at 5:23 AM, panam pa...@gmx.net wrote: Wow, this is pretty useful. Just to fit it more to my original use case, I used this: CREATE schema schema1; CREATE schema schema2; CREATE TABLE tbl (ID serial primary key,foo

Re: [GENERAL] any plans to support more rounding methods in sql?

2012-01-24 Thread Pavel Stehule
Hello 2012/1/25 raf r...@raf.org: hi, i just needed to round some numbers down to 4 decimal places but a quick search indicated that postgresql doesn't support all of the rounding methods so i had to write this dreadful function: create or replace function

Re: [GENERAL] any plans to support more rounding methods in sql?

2012-01-24 Thread Peter Geoghegan
On 25 January 2012 05:41, Pavel Stehule pavel.steh...@gmail.com wrote: Hello 2012/1/25 raf r...@raf.org: hi, i just needed to round some numbers down to 4 decimal places but a quick search indicated that postgresql doesn't support all of the rounding methods so i had to write this

Re: [GENERAL] Best way to create unique primary keys across schemas?

2012-01-24 Thread Chris Angelico
On Wed, Jan 25, 2012 at 9:54 AM, panam pa...@gmx.net wrote: What do you mean with explicit sequence object? An own sequence for each table per schema? This: On Wed, Jan 25, 2012 at 10:23 AM, Merlin Moncure mmonc...@gmail.com wrote: Barring domains, you can just manually apply the default