Re: [GENERAL] Problem with pl/python procedure connecting to the internet

2015-08-22 Thread Igor Sosa Mayor
Adrian Klaver writes: > Does the code work reliably outside Postgres? > It seems you are reliant on the availability of the OpenStreetMap > service and its ability to provide a timely response. > > So what exactly is the trigger event, INSERT, UPDATE, both? > > Is it absolutely necessary that thi

Re: [GENERAL] Problem with pl/python procedure connecting to the internet

2015-08-22 Thread John R Pierce
On 8/22/2015 12:23 AM, Igor Sosa Mayor wrote: Somehow I have the impression postgres is trying to make a connection without having to rights to get the answer (I'm on linux). I dont understand exactly which process (and with which rights) is executing the plpython procedure... Thanks in any case

Re: [GENERAL] master/master replication with load balancer in front

2015-08-22 Thread Chris Mair
> I see there are many different ways to build a PG cluster. What would be > the best choice in my case? Hi, a few keywords in your mail hint at the fact you're using AWS? If that's the case, you might want to look into their managed PostgreSQL hosting: it's called Amazon RDS for PostgreSQL and

Re: [GENERAL] Problem with pl/python procedure connecting to the internet

2015-08-22 Thread Igor Sosa Mayor
John R Pierce writes: > On 8/22/2015 12:23 AM, Igor Sosa Mayor wrote: >> Somehow I have the impression postgres is trying to make a connection >> without having to rights to get the answer (I'm on linux). I dont >> understand exactly which process (and with which rights) is executing >> the plpyt

Re: [GENERAL] Problem with pl/python procedure connecting to the internet

2015-08-22 Thread Adrian Klaver
On 08/22/2015 12:23 AM, Igor Sosa Mayor wrote: Adrian Klaver writes: Does the code work reliably outside Postgres? It seems you are reliant on the availability of the OpenStreetMap service and its ability to provide a timely response. So what exactly is the trigger event, INSERT, UPDATE, both

[GENERAL] PostgreSQL Developer Best Practices

2015-08-22 Thread Melvin Davidson
I've been searching for a "PostgreSQL Developer Best Practices" with not much luck, so I've started my own. At the risk of stirring up a storm of controversy, I would appreciate additional suggestions and feedback. As a way of clarifying, generally, a DBA is someone that is responsible for maintai

[GENERAL] How to use record variable with non-null domain in plpgsql

2015-08-22 Thread Andrus
I'm looging for a way to use tebool type records in plpgsql method starting from Postgres 9.1 I tried code below but got error domain tebool does not allow null values Domain tebool default value is false so plpgsql must assing false to it and should not throw error. How to fix this so that su

Re: [GENERAL] How to use record variable with non-null domain in plpgsql

2015-08-22 Thread Tom Lane
"Andrus" writes: > I'm looging for a way to use tebool type records in plpgsql method starting > from Postgres 9.1 > I tried code below but got error > domain tebool does not allow null values > Domain tebool default value is false so plpgsql must assing false to it and > should not throw error

Re: [GENERAL] PostgreSQL Developer Best Practices

2015-08-22 Thread Karsten Hilbert
On Sat, Aug 22, 2015 at 11:15:07AM -0400, Melvin Davidson wrote: > PostgreSQL Developer Best Practices > > 1. Prefix ALL literals with an Escape >EG: SELECT E'This is a \'quoted literal \''; > SELECT E'This is an unquoted literal'; > >Doing so will prevent the annoying "WARNING:

Re: [GENERAL] PostgreSQL Developer Best Practices

2015-08-22 Thread Melvin Davidson
>This is certainly not Best Practice as the warning is >annoying for a reason. >Best Practice would rather be something along the lines: > Avoid coding in a way that triggers "WARNING: > nonstandard use of escape in a string literal". If you > cannot comply with this rule do

Re: [GENERAL] PostgreSQL Developer Best Practices

2015-08-22 Thread Tom Lane
Melvin Davidson writes: >> Best Practice would rather be something along the lines: Avoid coding in a way that triggers "WARNING: nonstandard use of escape in a string literal". If you cannot comply with this rule document your reasons. > Thanks for the suggestion. For the past few

Re: [GENERAL] Problem with pl/python procedure connecting to the internet

2015-08-22 Thread Igor Sosa Mayor
Adrian Klaver writes: > Is the function you show here: > > http://pastie.org/10366558 > > the actual function you are using in the trigger? > > If so, there is no mechanism for getting the location coordinates into > the table, if that is what you want. > this is the function and there is a tri

Re: [GENERAL] How to use record variable with non-null domain in plpgsql

2015-08-22 Thread Andrus
Hi! TBH, the problem here is with the not-null constraint on the domain. Get rid of that and you'll be much happier. Is the only reasonable way is to change domain using ALTER DOMAIN tebool DROP NOT NULL ? bool types of columns are never used in database. Instead of them tebool type

Re: [GENERAL] PostgreSQL Developer Best Practices

2015-08-22 Thread Melvin Davidson
Tom, Thank you for pointing out "run with standard_conforming_strings = ON".. However, that is NOT the problem. What is occurring is that the developers are sending strings like 'Mr. M\'vey', which, if we set standard_conforming_strings = ON, would, and does, result in errors and the statement fai

Re: [GENERAL] 9.5 beta pg_upgrade documentation

2015-08-22 Thread Andy Colson
I finished running pg_upgrade on the primary, so far so good, and now I'm at step 9.5 (Verify). On the primary I see: root@test1:/pub/pg95# /usr/local/pg95/bin/pg_controldata -D /pub/pg95|grep "Latest check" Latest checkpoint location: 1D2/3628 I cannot run pg93 pg_controldata be

Re: [GENERAL] PostgreSQL Developer Best Practices

2015-08-22 Thread Andy Colson
On Sat, Aug 22, 2015 at 1:16 PM, Tom Lane mailto:t...@sss.pgh.pa.us>> wrote: Melvin Davidson mailto:melvin6...@gmail.com>> writes: >> Best Practice would rather be something along the lines: Avoid coding in a way that triggers "WARNING: nonstandard use of escape in a str

Re: [GENERAL] PostgreSQL Developer Best Practices

2015-08-22 Thread Melvin Davidson
>The correct way to escape a quote is to double quote it: 'Mr. M''vey' That is a matter of opinion. However, the real problem is the enclosed backslashes, which is beyond our control at this point. Therefore, the best solution is to use ESCAPE E. On Sat, Aug 22, 2015 at 3:49 PM, Andy Colson wro

Re: [GENERAL] PostgreSQL Developer Best Practices

2015-08-22 Thread David G. Johnston
On Saturday, August 22, 2015, Melvin Davidson wrote: > >The correct way to escape a quote is to double quote it: 'Mr. M''vey' > > That is a matter of opinion. However, the real problem is the enclosed > backslashes, which is > beyond our control at this point. Therefore, the best solution is to

Re: [GENERAL] PostgreSQL Developer Best Practices

2015-08-22 Thread John R Pierce
On 8/22/2015 12:40 PM, Melvin Davidson wrote: What is occurring is that the developers are sending strings like 'Mr. M\'vey', which, if we set standard_conforming_strings = ON, would, and does, result in errors and the statement failing, which is a lot less desirable that a simple warning. if

Re: [GENERAL] PostgreSQL Developer Best Practices

2015-08-22 Thread Melvin Davidson
John, I believe you and I think alike. The truth is, I was brought on as a consultant to help this client, so I do not have the authority to fire the developers. Rather, I am trying to help them fix the absolute worst designed DB and coding I have seen in 15 years of working with PostgreSQL. So I'

Re: [GENERAL] Problem with pl/python procedure connecting to the internet

2015-08-22 Thread Adrian Klaver
On 08/22/2015 10:16 AM, Igor Sosa Mayor wrote: Adrian Klaver writes: Is the function you show here: http://pastie.org/10366558 the actual function you are using in the trigger? If so, there is no mechanism for getting the location coordinates into the table, if that is what you want. th

Re: [GENERAL] PostgreSQL Developer Best Practices

2015-08-22 Thread David G. Johnston
On Sat, Aug 22, 2015 at 7:33 PM, Melvin Davidson wrote: > John, > > I believe you and I think alike. The truth is, I was brought on as a > consultant to help this client, so I do not have the authority to fire the > developers. Rather, I am trying to help them fix the absolute worst > designed DB

Re: [GENERAL] Problem with pl/python procedure connecting to the internet

2015-08-22 Thread Igor Sosa Mayor
Adrian Klaver writes: > Are you taking lack of coordinates in the table as evidence of no > connection or are you determining that some other way? thanks again for your answer. The evidence is very easy. I get this[1]. BUT: if I try exactly the same python code in a console there is no error and

Re: [GENERAL] Problem with pl/python procedure connecting to the internet

2015-08-22 Thread Charles Clavadetscher
> -Original Message- > From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general- > ow...@postgresql.org] On Behalf Of Igor Sosa Mayor > Sent: Sonntag, 23. August 2015 07:22 > To: pgsql-general@postgresql.org > Subject: Re: [GENERAL] Problem with pl/python procedure connecting to the >