Re: [GENERAL] State of the art for foreign keys to child tables?

2012-09-18 Thread Albe Laurenz
François Beausoleil wrote: > What's the state of the art for foreign keys on child tables? > > My use case is this: > > > CREATE TABLE parties(party_id serial primary key); > CREATE TABLE positions( PRIMARY KEY(party_id) ) INHERITS(parties); > CREATE TABLE organizations( PRIMARY KEY(party_id) )

Re: [GENERAL] log_destination = csvlog, line breaks interfere in analysis

2012-09-18 Thread Albe Laurenz
Craig Ringer wrote: > On 09/18/2012 03:21 AM, Edson Richter wrote: >> 2012-09-17 14:25:33.150 >> BRT,"thedb","thedb",15660,"10.10.20.1:33485",5054d3ab.3d2c,1,"SELECT",2012-09-15 >> 16:14:51 BRT,10/204822,0,LOG,0,"duração: 505.494 ms executar >> : select A, B >> from C join D >>

Re: [GENERAL] foreign key from array element

2012-09-18 Thread Rafal Pietrak
On Mon, 2012-09-17 at 14:31 -0500, Merlin Moncure wrote: > On Mon, Sep 17, 2012 at 7:24 AM, Rafal Pietrak > wrote: > > On Mon, 2012-09-17 at 19:58 +0800, Craig Ringer wrote: > >> On 09/17/2012 04:46 PM, Rafal Pietrak wrote: > > [--] > >> There was some quite recent discussion on ELEME

Re: [GENERAL] foreign key from array element

2012-09-18 Thread Albe Laurenz
Rafal Pietrak wrote: > On Mon, 2012-09-17 at 14:31 -0500, Merlin Moncure wrote: > > On Mon, Sep 17, 2012 at 7:24 AM, Rafal Pietrak > > wrote: > > > On Mon, 2012-09-17 at 19:58 +0800, Craig Ringer wrote: > > >> On 09/17/2012 04:46 PM, Rafal Pietrak wrote: > > > [--] > > >> There was so

Re: [GENERAL] Index creation takes more time?

2012-09-18 Thread Herouth Maoz
I think you hit the nail right on the head when you asked: > I wonder if they have different encoding/collations. [headdesk]Of course. One of the requirements of the upgrade was to change the database encoding to unicode, because previously it was in an 8-bit encoding and we couldn't handle int

Re: [GENERAL] RFE: Column aliases in WHERE clauses

2012-09-18 Thread Rafal Pietrak
On Mon, 2012-09-17 at 16:44 -0700, Mike Christensen wrote: > On Mon, Sep 17, 2012 at 4:32 PM, Tom Lane wrote: > > Mike Christensen writes: [---] > > It's easier to understand why this is if you realize that SQL has a very > > clear model of a "pipeline" of query execution. Conceptually

[GENERAL] Data recovery after inadvertent update?

2012-09-18 Thread Craig Ringer
Hi all Someone on SO has UPDATEd away some data they cared about. I've written a bit on what they might want to do, but really don't know enough, so I was hoping for some aid/ideas. In particular, is the advice to use " pg_ctl stop -m immediate" (to hopefully avoid a checkpoint) appropriate a

Re: [GENERAL] foreign key from array element

2012-09-18 Thread Chris Travers
On Tue, Sep 18, 2012 at 12:37 AM, Albe Laurenz wrote: > > > You :^) > > The list of patches for the commitfest is here: > https://commitfest.postgresql.org/action/commitfest_view?id=15 > > There is no reviewer for "Array ELEMENT Foreign Keys" yet. > > Silly question perhaps better saved for the re

Re: [GENERAL] Data recovery after inadvertent update?

2012-09-18 Thread Виктор Егоров
Check this post on depesz.com: http://www.depesz.com/2012/04/04/lets-talk-dirty/ 2012/9/18 Craig Ringer > Also, are there any functions to read raw tuple bytes to `RECORD's? I > couldn't find any in `pageinspect', `pgstattuple', `adminpack', etc. Am I > right in guessing that they're pretty much

[GENERAL] Move table - New schema

2012-09-18 Thread António Rodrigues
Hi list, (newbie question) I'm trying to move a set of tables between schemas. Tried: ALTER TABLE tablename SET SCHEMA schemaname It gives me error: "schema schemaname does not exist" (it does) Any help please. Thanks, António

Re: [GENERAL] foreign key from array element

2012-09-18 Thread Rafal Pietrak
On Tue, 2012-09-18 at 09:37 +0200, Albe Laurenz wrote: > Rafal Pietrak wrote: [--] > > > > Who can review that patch? > > You :^) ;7 OK. (still smiling a little) [---] > Here is information about what is required: > http://wiki.postgresql.org/wiki/Reviewing_a_Patch

Re: [GENERAL] log_destination = csvlog, line breaks interfere in analysis

2012-09-18 Thread Edson Richter
Em 18/09/2012 04:13, Albe Laurenz escreveu: Craig Ringer wrote: On 09/18/2012 03:21 AM, Edson Richter wrote: 2012-09-17 14:25:33.150 BRT,"thedb","thedb",15660,"10.10.20.1:33485",5054d3ab.3d2c,1,"SELECT",2012-09-15 16:14:51 BRT,10/204822,0,LOG,0,"duração: 505.494 ms executar : select A, B

Re: [GENERAL] foreign key from array element

2012-09-18 Thread Gabriele Bartolini
Hi Rafal, Il 18/09/12 13:00, Rafal Pietrak ha scritto: I did have a look, and feel slightly encouraged reading: "Many people feel that they're not qualified"; yes, that's me all right. Serously, I will try to do by best ... by the weekend, when I get some spare time. It is such a coincidence

Re: [GENERAL] Move table - New schema

2012-09-18 Thread Adrian Klaver
On 09/18/2012 03:48 AM, António Rodrigues wrote: Hi list, (newbie question) I'm trying to move a set of tables between schemas. Tried: ALTER TABLE tablename SET SCHEMA schemaname It gives me error: "schema schemaname does not exist" (it does) http://www.postgresql.org/docs/9.0/interac

Re: [GENERAL] Index creation takes more time?

2012-09-18 Thread Tom Lane
"Herouth Maoz" writes: > So, I must, at this point, draw the conclusion that string comparison is a > much, much heavier task in utf-8 than it is in an 8-bit encoding - or that > the collation is the problem. Going from "C" collation to anything else is generally a huge hit in terms of string c

Re: [GENERAL] Move table - New schema

2012-09-18 Thread António Rodrigues
You were both right. It was a problem with permissions. Thank you, António On Tue, Sep 18, 2012 at 2:37 PM, Adrian Klaver wrote: > On 09/18/2012 03:48 AM, António Rodrigues wrote: > >> Hi list, >> >> (newbie question) >> >> I'm trying to move a set of tables between schemas. >> >> Tried: >> >> AL

Re: [GENERAL] RFE: Column aliases in WHERE clauses

2012-09-18 Thread Chris Angelico
On Tue, Sep 18, 2012 at 4:44 PM, Craig Ringer wrote: > On 09/18/2012 07:32 AM, Tom Lane wrote: >> >> It's easier to understand why this is if you realize that SQL has a very >> clear model of a "pipeline" of query execution. > > I just wish they hadn't written it backwards! > > It'd be much less c

[GENERAL] Column aliases in WHERE clauses

2012-09-18 Thread Eden Cardim
> "Craig" == Craig Ringer writes: Craig> I just wish they hadn't written it backwards! Craig> It'd be much less confusing were it formulated as something Craig> like: Craig> SELECT FROM thetable WHERE first_letter > 'a' RESULTS Craig> left(value,1) AS first_letter C

Re: [GENERAL] How to access the extension's operator installed with schema ?

2012-09-18 Thread xoip
Thank you for the quick answer, problem solved. -- View this message in context: http://postgresql.1045698.n5.nabble.com/How-to-access-the-extension-s-operator-installed-with-schema-tp5724032p5724437.html Sent from the PostgreSQL - general mailing list archive at Nabble.com. -- Sent via pgsq

Re: [GENERAL] Column aliases in WHERE clauses

2012-09-18 Thread Mike Christensen
On Tue, Sep 18, 2012 at 2:53 AM, Eden Cardim wrote: >> "Craig" == Craig Ringer writes: > > Craig> I just wish they hadn't written it backwards! > > Craig> It'd be much less confusing were it formulated as something > Craig> like: > > Craig> SELECT FROM thetable WHERE first_let

Re: [GENERAL] On Ubuntu 12.04 i do have two psql one of those isn't working

2012-09-18 Thread Raymond O'Donnell
On 18/09/2012 16:10, Yvon Thoraval wrote: > I've found the prob. > In my postgresql.conf file the default port is setup to 5433 instead of > 5432 as previously... OK - you probably had two versions of PG installed at some point - when you install a second version of PG alongside an existing one on

[GENERAL] Time-based trigger

2012-09-18 Thread Robert Sosinski
We have a table, which has items that can be put on hold of 5 minutes (this is for an online store) once they are placed into a cart. What we need is for this hold to automatically expire after 5 minutes. Right now, we put a time stamp into the row (called hold_until) at 5 minutes into the fut

Re: [GENERAL] Time-based trigger

2012-09-18 Thread Szymon Guz
On 18 September 2012 17:59, Robert Sosinski wrote: > We have a table, which has items that can be put on hold of 5 minutes > (this is for an online store) once they are placed into a cart. What we > need is for this hold to automatically expire after 5 minutes. Right now, > we put a time stamp

Re: [GENERAL] On Ubuntu 12.04 i do have two psql one of those isn't working

2012-09-18 Thread Yvon Thoraval
2012/9/18 Raymond O'Donnell > On 18/09/2012 16:10, Yvon Thoraval wrote: > > I've found the prob. > > In my postgresql.conf file the default port is setup to 5433 instead of > > 5432 as previously... > > OK - you probably had two versions of PG installed at some point - when > you install a second

Re: [GENERAL] On Ubuntu 12.04 i do have two psql one of those isn't working

2012-09-18 Thread Yvon Thoraval
I've found the prob. In my postgresql.conf file the default port is setup to 5433 instead of 5432 as previously... sorry for the noise.

Re: [GENERAL] Time-based trigger

2012-09-18 Thread Rob Sargent
On 09/18/2012 10:03 AM, Szymon Guz wrote: On 18 September 2012 17:59, Robert Sosinski mailto:rsosin...@ticketevolution.com>> wrote: We have a table, which has items that can be put on hold of 5 minutes (this is for an online store) once they are placed into a cart. What we need is f

Re: [GENERAL] Index creation takes more time?

2012-09-18 Thread Jeff Janes
On Tue, Sep 18, 2012 at 1:13 AM, Herouth Maoz wrote: > I think you hit the nail right on the head when you asked: > > > >> I wonder if they have different encoding/collations. > > [headdesk]Of course. One of the requirements of the upgrade was to change > the database encoding to unicode, because

Re: [GENERAL] Slow counting still true?

2012-09-18 Thread Jeff Janes
On Mon, Sep 17, 2012 at 9:14 AM, Edson Richter wrote: > The wiki page in question has been updated today, and I see the alert in top > of page "Note that the following article only applies to versions of > PostgreSQL prior to 9.2. Index-only scans are now implemented." > > So seems that traversin

Re: [GENERAL] Column aliases in WHERE clauses

2012-09-18 Thread Mike Christensen
On Tue, Sep 18, 2012 at 11:20 AM, Eden Cardim wrote: >> "Mike" == Mike Christensen writes: > > Mike> I can also say if the table came before the columns, we'd > Mike> probably have a lot more SQL editors with auto-complete that > Mike> worked :) > > There's nothing stopping an edi

Re: [GENERAL] foreign key from array element

2012-09-18 Thread Rafal Pietrak
Hi, On Tue, 2012-09-18 at 15:12 +0200, Gabriele Bartolini wrote: > Hi Rafal, [] > > It is such a coincidence that yesterday I had started to write this > article > (http://blog.2ndquadrant.com/postgresql-9-3-development-array-element-foreign-keys/) > > about this feature for 9.3

Re: [GENERAL] Time-based trigger

2012-09-18 Thread Steve Crawford
On 09/18/2012 08:59 AM, Robert Sosinski wrote: We have a table, which has items that can be put on hold of 5 minutes (this is for an online store) once they are placed into a cart. What we need is for this hold to automatically expire after 5 minutes. Right now, we put a time stamp into the r

Re: [GENERAL] Column aliases in WHERE clauses

2012-09-18 Thread Eden Cardim
> "Mike" == Mike Christensen writes: Mike> I can also say if the table came before the columns, we'd Mike> probably have a lot more SQL editors with auto-complete that Mike> worked :) There's nothing stopping an editor from making you type the table first though, it's easier to i

Re: [GENERAL] foreign key from array element

2012-09-18 Thread Kevin Grittner
Rafal Pietrak wrote: > where do I get current-v9.3 from? At this point 9.3 just means the HEAD of the master branch of the git repository, which is where development for the next major release of software is always done. For details of the public git repository see: http://git.postgresql.org/

Re: [GENERAL] checkpoint_timeout and archive_timeout

2012-09-18 Thread Jeff Janes
On Tue, Sep 11, 2012 at 5:36 AM, Kevin Grittner wrote: > Jeff Janes wrote: >> Kevin Grittner wrote: > >>> BTW, that's also why I wrote the pg_clearxlogtail utility (source >>> code on pgfoundry). We pipe our archives through that and gzip >>> which changes this to an endless stream of 16KB files

[GENERAL] Double types

2012-09-18 Thread Hall, Samuel L (Sam)
I have an application that writes an Excel Spreadsheet to postgres. For the values that go in number fields, I check the Excel values for dbnull and set the parameters to 0, like this: cmd.Parameters(9).Value = 0. Npgsql throws an error "format specifier was invalid" If I do this: cmd.Parameter

Re: [GENERAL] foreign key from array element

2012-09-18 Thread Rafal Pietrak
On Tue, 2012-09-18 at 15:38 -0500, Kevin Grittner wrote: > Rafal Pietrak wrote: > > where do I get current-v9.3 from? > > At this point 9.3 just means the HEAD of the master branch of the > git repository, which is where development for the next major > release of software is always done. For d

Re: [GENERAL] checkpoint_timeout and archive_timeout

2012-09-18 Thread Kevin Grittner
Jeff Janes wrote: > Kevin Grittner wrote: >> We pipe the file into pg_clearxlogtail | gzip and pipe it out to >> the archive directory (with a ".gz" suffix), rather than using cp >> and processing it later. Well, actually, we pipe it to a >> directory on the same mount point as the archive dir

Re: [GENERAL] Double types

2012-09-18 Thread Chris Angelico
On Wed, Sep 19, 2012 at 7:25 AM, Hall, Samuel L (Sam) wrote: > > I have an application that writes an Excel Spreadsheet to postgres. For the > values that go in number fields, I check the Excel values for dbnull and set > the parameters to 0, like this: cmd.Parameters(9).Value = 0. Npgsql throws

Re: [GENERAL] foreign key from array element

2012-09-18 Thread Tom Lane
Rafal Pietrak writes: > postmaster/postmaster.o: In function `PostmasterMain':^M > postmaster.c:(.text+0x4bc8): undefined reference to `optreset'^M > tcop/postgres.o: In function `process_postgres_switches':^M > postgres.c:(.text+0x1422): undefined reference to `optreset'^M > utils/misc/ps_status.

[GENERAL] Change key primary for key foreign

2012-09-18 Thread Guilherme Rodrigues
Hello. I want to change one table already created. Where the comand? thank you. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Change key primary for key foreign

2012-09-18 Thread Raymond O'Donnell
On 18/09/2012 21:37, Guilherme Rodrigues wrote: > Hello. I want to change one table already created. Where the comand? thank > you. ALTER TABLE http://www.postgresql.org/docs/9.2/static/sql-altertable.html What exactly do you want to do? Ray. -- Raymond O'Donnell :: Galway :: Ireland r.

Re: [GENERAL] foreign key from array element

2012-09-18 Thread Chris Travers
On Tue, Sep 18, 2012 at 6:12 AM, Gabriele Bartolini < gabriele.bartol...@2ndquadrant.it> wrote: > Hi Rafal, > > Il 18/09/12 13:00, Rafal Pietrak ha scritto: > > I did have a look, and feel slightly encouraged reading: "Many people >> feel that they're not qualified"; yes, that's me all right. Ser

[GENERAL] Difference between ON and WHERE in JOINs

2012-09-18 Thread Jean-Christophe Boggio
I'm looking for an article that explains the difference between these constructs IN POSTGRESQL (the rules seem to differ from one DB to another) : SELECT A.* FROM A JOIN B ON a.id=b.id AND A.somefield='somevalue' and SELECT A.* FROM A JOIN B ON a.id=b.id WHERE A.somefield='somevalue' I have

Re: [GENERAL] Difference between ON and WHERE in JOINs

2012-09-18 Thread David Johnston
On Sep 18, 2012, at 20:21, Jean-Christophe Boggio wrote: > I'm looking for an article that explains the difference between these > constructs IN POSTGRESQL (the rules seem to differ from one DB to another) : > > SELECT A.* > FROM A > JOIN B ON a.id=b.id AND A.somefield='somevalue' > > and >

Re: [GENERAL] Column aliases in WHERE clauses

2012-09-18 Thread Eden Cardim
> "Mike" == Mike Christensen writes: Mike> No, I meant editors that auto-complete SQL statements for Mike> you as you're typing them. Like Intellisense in Visual Mike> Studio. Mike> Obviously you wouldn't want to type "select " and then see a Mike> list of every column in

Re: [GENERAL] Change key primary for key foreign

2012-09-18 Thread Guilherme Rodrigues
I created one table so: CREATE TABLE clima ( city char(80), cprc int, ); And have other table so: CREATE TABLE city ( namechar(80), other_thing int, ); But now I want the table clima receive name table city as foreign key. understand? Sorry my bad englis

Re: [GENERAL] Column aliases in WHERE clauses

2012-09-18 Thread Chris Travers
On Tue, Sep 18, 2012 at 2:53 AM, Eden Cardim wrote: > > "Craig" == Craig Ringer writes: > > Craig> I just wish they hadn't written it backwards! > > Craig> It'd be much less confusing were it formulated as something > Craig> like: > > Craig> SELECT FROM thetable WHERE first_l

Re: [GENERAL] Change key primary for key foreign

2012-09-18 Thread Edson Richter
Em 18/09/2012 21:25, Guilherme Rodrigues escreveu: I created one table so: CREATE TABLE clima ( city char(80), cprc int, ); And have other table so: CREATE TABLE city ( namechar(80), other_thing int, ); But now I want the table clima receive name ta

Re: [GENERAL] RFE: Column aliases in WHERE clauses

2012-09-18 Thread Steve Haresnape
Hi There, I've snipped a piece for the daily digest because I take issue with what's asserted here as a reason for not allowing aliases in where clauses. << snipThis isn't just academic nit-picking either, because the SELECT expressions might not be valid for rows that don't pass WHERE etc.