Re: [GENERAL] Why PG uses nested-loop join when no indexes are available?

2016-01-14 Thread David Rowley
On 14 January 2016 at 03:48, David Grelaud wrote: > 3) Always avoid nested-loop join when no indexes are available? > > Tom Lane said "There might be some cases where this would help, but there > would be many more where it would be useless or counterproductive." > Who is right between Tom Lane a

Re: [GENERAL] pg_dump problem with dropped NOT NULL on child table

2016-01-14 Thread Karsten Hilbert
On Wed, Jan 13, 2016 at 12:10:15PM -0800, Adrian Klaver wrote: > On 01/13/2016 11:38 AM, Karsten Hilbert wrote: > > create table parent ( > > not_null_in_parent integer not null > > ); > > > > create table child() inherits (parent); > > alter table child > >

Re: [GENERAL] pg_dump problem with dropped NOT NULL on child table

2016-01-14 Thread Karsten Hilbert
On Wed, Jan 13, 2016 at 03:32:12PM -0500, Tom Lane wrote: > Karsten Hilbert writes: > > create table parent ( > > not_null_in_parent integer not null > > ); > > > create table child() inherits (parent); > > alter table child > > alter column not_null_in_p

[GENERAL] master slave failover - secondary slaves

2016-01-14 Thread Steven Livingstone
Hi all, I am relatively new to Postgres but after some some work master/slave replication and failover working. I can use a trigger file to promote my first slave to a new master but where I am confused (from reading various docs) is quite how the second, third and so on slaves know there is a new

Re: [GENERAL] master slave failover - secondary slaves

2016-01-14 Thread Andreas Kretschmer
Steven Livingstone wrote: > Hi all, I am relatively new to Postgres but after some some work master/slave > replication and failover working. > > I can use a trigger file to promote my first slave to a new master but where I > am confused (from reading various docs) is quite how the second, thir

Re: [GENERAL] master slave failover - secondary slaves

2016-01-14 Thread Steven Livingstone
Thanks Andreas - that looks ideal. Steven Livingstone wrote: > Hi all, I am relatively new to Postgres but after some some work master/slave > replication and failover working. > > I can use a trigger file to promote my first slave to a new master but where I > am confused (from reading various

Re: [GENERAL] Function error

2016-01-14 Thread Albe Laurenz
Sachin Srivastava wrote: > In my function the problem is that global variables defined inside the > function. > These variables are visible to functions defined inside a function. > If we move these inner functions to outside of the main function, > they will lose the visibility of the global vari

Re: [GENERAL] Why PG uses nested-loop join when no indexes are available?

2016-01-14 Thread Tom Lane
David Rowley writes: > Perhaps separating out enable_nestloop so that it only disables > non-parameterised nested loops, and add another GUC for parameterised > nested loops would be a good thing to do. Likely setting enable_nestloop to > off in production would be a slightly easier decision to ma

Re: [GENERAL] WIP: CoC V5, etc., etc., etc., etc., ....

2016-01-14 Thread Joshua D. Drake
On 01/13/2016 06:00 PM, Berend Tober wrote: Whether or not it is a foregone conclusion that this community will adopt a CoC, it seems like a mailing list is not the place to do revision control. Can you people start a github project or something to develope your ideas and come back when you have

Re: [GENERAL] pg_dump problem with dropped NOT NULL on child table

2016-01-14 Thread Adrian Klaver
On 01/14/2016 12:59 AM, Karsten Hilbert wrote: On Wed, Jan 13, 2016 at 12:10:15PM -0800, Adrian Klaver wrote: On 01/13/2016 11:38 AM, Karsten Hilbert wrote: create table parent ( not_null_in_parent integer not null ); create table child() inherits (pa

Re: [GENERAL] Exclude bdr data from dump

2016-01-14 Thread Adrian Klaver
On 01/13/2016 12:18 PM, Roland van Laar wrote: Hello, I want to exclude all bdr data from a database dump. My command is: $ bdr_dump -Fp -h localhost -U postgres mydb -f /tmp/mydb.data --data-only --exclude-table='bdr* This results in bdr data being included. Did you mean excluded above?

Re: [GENERAL] WIP: CoC V5, etc., etc., etc., etc., ....

2016-01-14 Thread Adrian Klaver
On 01/14/2016 08:24 AM, Joshua D. Drake wrote: On 01/13/2016 06:00 PM, Berend Tober wrote: Whether or not it is a foregone conclusion that this community will adopt a CoC, it seems like a mailing list is not the place to do revision control. Can you people start a github project or something to

Re: [GENERAL] WIP: CoC V5

2016-01-14 Thread Joshua D. Drake
Updated. Tl;dr; * Removed excess wording * Removed non-.org controlled spaces in first paragraph * Added explicit discussion on explicit problem with last paragraph of Kevin's last version. == PostgreSQL Community Code of Conduct (CoC) == This document is intended to provide community gui

Re: [GENERAL] WIP: CoC V5, etc., etc., etc., etc., ....

2016-01-14 Thread Joshua D. Drake
On 01/14/2016 08:30 AM, Adrian Klaver wrote: On 01/14/2016 08:24 AM, Joshua D. Drake wrote: On 01/13/2016 06:00 PM, Berend Tober wrote: Whether or not it is a foregone conclusion that this community will adopt a CoC, it seems like a mailing list is not the place to do revision control. Can you

Re: [GENERAL] WIP: CoC V5

2016-01-14 Thread Geoff Winkless
On 14 January 2016 at 16:37, Joshua D. Drake wrote: > If someone stands up in a respectful way in a public place and argues > a position, they should not be demonized or punished for that. I completely agree with you, unfortunately there are enough people who are so militant about their particula

Re: [GENERAL] WIP: CoC V5

2016-01-14 Thread Joshua D. Drake
On 01/14/2016 08:53 AM, Geoff Winkless wrote: On 14 January 2016 at 16:37, Joshua D. Drake wrote: If someone stands up in a respectful way in a public place and argues a position, they should not be demonized or punished for that. I completely agree with you, unfortunately there are enough pe

Re: [GENERAL] WIP: CoC V5

2016-01-14 Thread Neil
> On Jan 14, 2016, at 10:37 AM, Joshua D. Drake wrote: > > Now, how does this apply (as an example)? There are very loud people in this > community who are pro-gay marriage and they are unable to respect those who > don't agree with the position. There are also those who are anti-gay marriage

Re: [GENERAL] WIP: CoC V5

2016-01-14 Thread Joshua D. Drake
On 01/14/2016 09:14 AM, Neil wrote: The community needs to decide between the following: 1. Does it want to eliminate participation from people with strong but opposing views. or 2. Does it want to enforce respect and tolerance that allows people with strong but opposing views to contribute

Re: [GENERAL] WIP: CoC V5

2016-01-14 Thread Geoff Winkless
On 14 January 2016 at 17:11, Joshua D. Drake wrote: > Right but here is the rub. Being anti-gay marriage isn't an extreme opinion. > It is a minority opinion for sure but it is certainly not extreme. Well it is - it's an extremity in the range of potential view points. > Another issue, consider

Re: [GENERAL] WIP: CoC V5

2016-01-14 Thread Joshua D. Drake
tl;dr; * added being tolerant of opposing views == PostgreSQL Community Code of Conduct (CoC) == This document is intended to provide community guidelines for creating and enforcing a safe, respectful, productive, and collaborative place for any person who is willing to contribute in a safe, r

Re: [GENERAL] WIP: CoC V5

2016-01-14 Thread Adrian Klaver
On 01/14/2016 09:11 AM, Joshua D. Drake wrote: On 01/14/2016 08:53 AM, Geoff Winkless wrote: On 14 January 2016 at 16:37, Joshua D. Drake wrote: If someone stands up in a respectful way in a public place and argues a position, they should not be demonized or punished for that. I completely a

Re: [GENERAL] WIP: CoC V5

2016-01-14 Thread S McGraw
On 01/14/2016 09:53 AM, Geoff Winkless wrote: > On 14 January 2016 at 16:37, Joshua D. Drake wrote: >> If someone stands up in a respectful way in a public place and argues >> a position, they should not be demonized or punished for that. I am not a contributor to Postgresql (tho I have contribut

Re: [GENERAL] WIP: CoC V5

2016-01-14 Thread Chris Travers
On Thu, Jan 14, 2016 at 5:37 PM, Joshua D. Drake wrote: > Updated. > > Tl;dr; > > * Removed excess wording > * Removed non-.org controlled spaces in first paragraph > * Added explicit discussion on explicit problem with last paragraph of > Kevin's last version. > > == PostgreSQL Community Code

[GENERAL] Postgres BDR bdr_init_copy fails

2016-01-14 Thread Nikhil
hello , I am trying to setup 2 -node bdr group. i have 5 databases in node 1. i created groups for each db in node-1. then did pg_basebackup from node -2 and started bdr_init_copy. Its giving below error. *bdr_init_copy* bdr_init_copy: starting ... Getting remote server identification ... Dete

[GENERAL] regexp_replace

2016-01-14 Thread Andy Colson
Hi all. This is not doing as I'd expected: select regexp_replace('71.09.6.01.3', '(\d)[.-](\d)', '\1\2', 'g'); regexp_replace 71096.013 (1 row) It acts the same with dashes: select regexp_replace('71-09-6-01-3', '(\d)[.-](\d)', '\1\2', 'g'); regexp_replace

Re: [GENERAL] regexp_replace

2016-01-14 Thread Tom Lane
Andy Colson writes: > This is not doing as I'd expected: > select regexp_replace('71.09.6.01.3', '(\d)[.-](\d)', '\1\2', 'g'); > regexp_replace > > 71096.013 > (1 row) I think regexp_replace considers only non-overlapping substrings, eg, once it's replaced 1.0 with 10, it t

Re: [GENERAL] regexp_replace

2016-01-14 Thread John McKown
How about: select regexp_replace('71.09.6.01.3', '(\d)[.-]', '\1', 'g'); ? In your example, the (\d)[.-](\d) says find a digit followed by a period or dash followed by another digit. The first time through 1.0 is matched and replaced with 10 (710) with the "current location" pointing before the

Re: [GENERAL] regexp_replace

2016-01-14 Thread Andy Colson
On 1/14/2016 1:59 PM, Tom Lane wrote: Andy Colson writes: This is not doing as I'd expected: select regexp_replace('71.09.6.01.3', '(\d)[.-](\d)', '\1\2', 'g'); regexp_replace 71096.013 (1 row) I think regexp_replace considers only non-overlapping substrings, eg,

Re: [GENERAL] regexp_replace

2016-01-14 Thread David G. Johnston
On Thu, Jan 14, 2016 at 12:43 PM, Andy Colson wrote: > Hi all. > > This is not doing as I'd expected: > > select regexp_replace('71.09.6.01.3', '(\d)[.-](\d)', '\1\2', 'g'); > > regexp_replace > > 71096.013 > (1 row) > > ​Solution: select regexp_replace('71.09.6.01.3', '(\d)[.-

Re: [GENERAL] regexp_replace

2016-01-14 Thread Andy Colson
On 1/14/2016 2:02 PM, John McKown wrote: How about: select regexp_replace('71.09.6.01.3', '(\d)[.-]', '\1', 'g'); match is 1.3 and result is 13 ( 71096.013). If you don't want to eliminate the period or dash unless it is _between_ two digits, try: select regexp_replace('71.09.6.01.3', '(\d)[.-

Re: [GENERAL] regexp_replace

2016-01-14 Thread Andy Colson
On 1/14/2016 2:06 PM, David G. Johnston wrote: select regexp_replace('71.09.6.01.3', '(\d)[.-](?=\d)', '\1\2', 'g'); Thanks David! -Andy -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-genera

Re: [GENERAL] regexp_replace

2016-01-14 Thread David G. Johnston
On Thu, Jan 14, 2016 at 1:27 PM, Andy Colson wrote: > On 1/14/2016 2:06 PM, David G. Johnston wrote: > >> select regexp_replace('71.09.6.01.3', '(\d)[.-](?=\d)', '\1\2', 'g'); >> > ​John already picked up on the fact that the "\2" in the replacement is pointless (neither helping nor hurting) sin

Re: [GENERAL] v9.1, DROP TRIGGER IF EXISTS behaving oddly

2016-01-14 Thread Williamson, Michael
Please excuse my mistake. We were dropping a view that had the trigger on it beforehand, then in trying to re-build the entire schema had scripts that attempted to drop trigger if they existed before re-creating the view and triggers.  I over-sanitized the example I posted and made it unclear. I

Re: [GENERAL] Query Questions - PostgreSQL

2016-01-14 Thread Saulo Merlo
On 13/01/2016, at 3:30 PM, Saulo Merlo wrote: So.. I have a Query that is taking too long to complete. OLD QUERY: SELECT file.inode_idAS file_id, file.parent_inode_id AS file_group, file.relative_path AS file_type, file.file_data AS file_binary, file.node_full_path AS

Re: [GENERAL] WIP: CoC V6

2016-01-14 Thread Joshua D. Drake
Hello, I posted this earlier but ended up breaking my own silly rev scheme. So, I am going back to my silly rev scheme. Rev 6 it is: tl;dr; * added being tolerant of opposing views * Removed excess wording from Grittner's version * Removed non-.org controlled spaces in first paragraph ==

Re: [GENERAL] v9.1, DROP TRIGGER IF EXISTS behaving oddly

2016-01-14 Thread Adrian Klaver
On 01/14/2016 01:47 PM, Williamson, Michael wrote: Please excuse my mistake. We were dropping a view that had the trigger on it beforehand, then in trying to re-build the entire schema had scripts that attempted to drop trigger if they existed before re-creating the view and triggers. I over-sa

[GENERAL] PgDay LFNW April 23rd & 24th (can you speak?)

2016-01-14 Thread Joshua D. Drake
Folks, The CFP is open for this, it can be found here: http://linuxfestnorthwest.org/2016/present As usual, we have a dedicated track to PostgreSQL. We however tend to lack topics of the intro variety. It would be great if we could get some folks to submit talks on: PostgreSQL 101: How to g

Re: [GENERAL] Why PG uses nested-loop join when no indexes are available?

2016-01-14 Thread David Rowley
On 15 January 2016 at 04:00, Tom Lane wrote: > David Rowley writes: > > Perhaps separating out enable_nestloop so that it only disables > > non-parameterised nested loops, and add another GUC for parameterised > > nested loops would be a good thing to do. Likely setting enable_nestloop > to > >

Re: [GENERAL] WIP: CoC V6

2016-01-14 Thread Steve Petrie, P.Eng.
Please see my two suggestions below. Steve - Original Message - From: "Joshua D. Drake" To: "Neil" ; "Psql_General (E-mail)" Sent: Thursday, January 14, 2016 4:48 PM Subject: Re: [GENERAL] WIP: CoC V6 Hello, I posted this earlier but ended up breaking my own silly rev scheme. S