Re: Problem with trigger makes Detail record be invalid

2018-04-19 Thread PegoraroF10
Correct, that delete done a partial commit. And this is absolutely unacceptable. I know I did that trigger incorrectly but referential integrity is obligatory. Imagine if I have a database crash and need to restore as soon as possible. How much time I´ll spend removing those records from a backup

Re: Dynamically filtering a CTE?

2018-04-19 Thread David G. Johnston
On Thursday, April 19, 2018, W. Trevor King wrote: > Is there > an idiomatic way to approach this problem? > > I would use pl/pgsql as the language and build a query using a combination of text literals and the format() function - invoking via pl/pgsql's EXECUTE command.

Dynamically filtering a CTE?

2018-04-19 Thread W. Trevor King
I have a slow ‘WITH RECURSIVE’ CTE like: CREATE VIEW ancestors AS WITH RECURSIVE _ancestors(descendant, ancestors) AS ( SELECT item.id AS id, ARRAY[item.ancestor_id] AS ancestors FROM items AS item UNION ALL SELECT child.id AS id

Re: Problem with trigger makes Detail record be invalid

2018-04-19 Thread Ken Tanzer
On Thu, Apr 19, 2018 at 12:21 PM, Tom Lane wrote: > =?UTF-8?Q?Fabr=C3=ADzio_de_Royes_Mello?= writes: > > 2018-04-19 15:57 GMT-03:00 Tom Lane : > >> (I'm not sure that this issue is adequately documented, though. > >> I'd have

Re: A couple of pg_dump questions

2018-04-19 Thread David G. Johnston
On Thu, Apr 19, 2018 at 3:39 PM, Ron wrote: > > $ pg_dump --host=farawaysrvr -Fc $REMOTEDB > /local/disk/backups/$REMOTEDB. > dump > > Is the data compressed on the remote server (thus minimizing traffic on > the wire), or locally? (I'd test this myself, but the company

A couple of pg_dump questions

2018-04-19 Thread Ron
$ pg_dump --host=farawaysrvr -Fc $REMOTEDB > /local/disk/backups/$REMOTEDB.dump Is the data compressed on the remote server (thus minimizing traffic on the wire), or locally?  (I'd test this myself, but the company has really strict firewall rules in place.) $ pg_dump --host=farawaysrvr -Fc

Re: Inconsistent compilation error

2018-04-19 Thread Melvin Davidson
On Thu, Apr 19, 2018 at 8:13 AM, David G. Johnston < david.g.johns...@gmail.com> wrote: > On Wednesday, April 18, 2018, Adrian Klaver > wrote: >> >> Hmm, wonder if there is an oops in the below: >> >> http://www.pygresql.org/contents/changelog.html >> >> Version 5.0

Re: Problem with trigger makes Detail record be invalid

2018-04-19 Thread Tom Lane
=?UTF-8?Q?Fabr=C3=ADzio_de_Royes_Mello?= writes: > 2018-04-19 15:57 GMT-03:00 Tom Lane : >> (I'm not sure that this issue is adequately documented, though. >> I'd have expected to find something about it in triggers.sgml and/or >> create_trigger.sgml,

Re: Problem with trigger makes Detail record be invalid

2018-04-19 Thread David G. Johnston
On Thu, Apr 19, 2018 at 11:57 AM, Tom Lane wrote: > (I'm not sure that this issue is adequately documented, though. > I'd have expected to find something about it in triggers.sgml and/or > create_trigger.sgml, but in a quick look neither of them mentions foreign > keys.) >

Re: Problem with trigger makes Detail record be invalid

2018-04-19 Thread Fabrízio de Royes Mello
2018-04-19 15:57 GMT-03:00 Tom Lane : > > Adrian Klaver writes: > > On 04/19/2018 10:55 AM, PegoraroF10 wrote: > >> Is this a bug or it´s mine responsability to check that trigger result ? > > > Without seeing exactly what the trigger function on

Re: Problem with trigger makes Detail record be invalid

2018-04-19 Thread Adrian Klaver
On 04/19/2018 11:52 AM, PegoraroF10 wrote: My point of view that there was a partial rollback, just on detail table. If I´ve done a delete from Master and I have a foreign key to it with cascade option, or all records should be deleted or no one should, this is my point. Except you now have a

Re: Problem with trigger makes Detail record be invalid

2018-04-19 Thread Tom Lane
Adrian Klaver writes: > On 04/19/2018 10:55 AM, PegoraroF10 wrote: >> Is this a bug or it´s mine responsability to check that trigger result ? > Without seeing exactly what the trigger function on Detail is doing that > is not answerable. I think the OP is

Re: Problem with trigger makes Detail record be invalid

2018-04-19 Thread PegoraroF10
My point of view that there was a partial rollback, just on detail table. If I´ve done a delete from Master and I have a foreign key to it with cascade option, or all records should be deleted or no one should, this is my point. Did you see that Master table has no records and Detail table has

Re: Doubts about replication..

2018-04-19 Thread Edmundo Robles
Yes, you are right, the replication is not a backup ;) , actually i backup database daily at 3:00 am but if database crash, the amount of data is big! that is the reason i want to replicate to reduce the data loss. By the way a few days ago a job partner did a delete with no where.

Re: Problem with trigger makes Detail record be invalid

2018-04-19 Thread Adrian Klaver
On 04/19/2018 11:30 AM, PegoraroF10 wrote: I know my trigger is incorrect. I know that I can use TG_OP to know what operation is being done. My question is ... Is this a bug or it´s mine responsability to check that trigger result ? I think it´s a bug because if something got wrong on detail

Re: Problem with trigger makes Detail record be invalid

2018-04-19 Thread Adrian Klaver
On 04/19/2018 11:30 AM, PegoraroF10 wrote: I know my trigger is incorrect. I know that I can use TG_OP to know what operation is being done. My question is ... Is this a bug or it´s mine responsability to check that trigger result ? I think it´s a bug because if something got wrong on detail

Re: Doubts about replication..

2018-04-19 Thread Andreas Kretschmer
Am 19.04.2018 um 19:57 schrieb Edmundo Robles: I will use replication as simple backup. please keep in mind, replication is not a backup. All logical errors on the master (delete from table and forgot the where-condition) will replicated to the standby. Andreas -- 2ndQuadrant - The

Re: Doubts about replication..

2018-04-19 Thread Adrian Klaver
On 04/19/2018 10:57 AM, Edmundo Robles wrote: I have several versions of postgres 9.4.5, 9.4.4, 9.4.15 (3), 9.5.3 in different versions of Debian 7.6, 7.8, 7.11, 8.5 and 8.6. I need to replicate the databases and I have clear that I must update all to one version. My main question is, Do you 

Re: Problem with trigger makes Detail record be invalid

2018-04-19 Thread PegoraroF10
I know my trigger is incorrect. I know that I can use TG_OP to know what operation is being done. My question is ... > Is this a bug or it´s mine responsability to check that trigger result ? I think it´s a bug because if something got wrong on detail deletion and it was rolled back, how could

Re: Doubts about replication..

2018-04-19 Thread Vick Khera
You want the replication for backup purposes. What is the use case for your backups: Is it disaster recovery? Is it archiving historical data? Is it failover? Is it off-site backup? If you outline your needs then the proper solution can be offered. There are other methods than just using the

Re: Problem with trigger makes Detail record be invalid

2018-04-19 Thread Adrian Klaver
On 04/19/2018 10:55 AM, PegoraroF10 wrote: I´m using Postgres 10 on ubuntu. suppose a simple Master/Detail structure like this: create table Master(ID integer primary key, name text); create table Detail(ID integer primary key, Master_ID Integer, OtherInfo text); alter table Detail add

Doubts about replication..

2018-04-19 Thread Edmundo Robles
I have several versions of postgres 9.4.5, 9.4.4, 9.4.15 (3), 9.5.3 in different versions of Debian 7.6, 7.8, 7.11, 8.5 and 8.6. I need to replicate the databases and I have clear that I must update all to one version. My main question is, Do you recommended me update to 9.6 or better update to

Problem with trigger makes Detail record be invalid

2018-04-19 Thread PegoraroF10
I´m using Postgres 10 on ubuntu. suppose a simple Master/Detail structure like this: create table Master(ID integer primary key, name text); create table Detail(ID integer primary key, Master_ID Integer, OtherInfo text); alter table Detail add constraint FKMasterDetail foreign key (Master_ID)

Re: postgres with graph model

2018-04-19 Thread Thomas Kellerer
Philipp Kraus schrieb am 19.04.2018 um 16:53: I’m using in a project Postgresql and PostGIS for a geospatial data model, but now I need also a graph in this structure, so my question is, is there any existing extension for Postgres to build a graph. I found ltree but this is for tree structures

Re: postgres with graph model

2018-04-19 Thread Philipp Kraus
Thanks, seems to be a good idea, but I need some routing on geo position data, but also some graph algorithm depends on machine learning structures, if I can use the pgRouting project to deal with a „feature graph“ and geo-partial data this will be great, I will test it Thanks for this hint

Re: postgres with graph model

2018-04-19 Thread Fabrízio de Royes Mello
Em qui, 19 de abr de 2018 às 11:54, Philipp Kraus < philipp.kr...@tu-clausthal.de> escreveu: > Hello, > > I’m using in a project Postgresql and PostGIS for a geospatial data model, > but now I need also a graph in this structure, so my question is, is there > any existing > extension for Postgres

postgres with graph model

2018-04-19 Thread Philipp Kraus
Hello, I’m using in a project Postgresql and PostGIS for a geospatial data model, but now I need also a graph in this structure, so my question is, is there any existing extension for Postgres to build a graph. I found ltree but this is for tree structures only, not for graphs. In general I

Re: pg_upgrade: when the --old-bindir requires "additional" $libdir/ plugins?

2018-04-19 Thread Jerry Sievers
Adrian Klaver writes: > On 04/18/2018 07:22 AM, Tom Lane wrote: > >> Pavel Raiskup writes: >>> . and it seems like the hstore.so was somewhat intimately integrated into >>> OP's database so the '/usr/bin/pg_dump --schema-only --binary-upgrade >>>

Re: pg_upgrade help

2018-04-19 Thread Akshay Ballarpure
Hi Fabio, I think you have found the problem. Please find o/p below. -bash-4.2$ ps -aef | grep postgres postgres 478 1 0 13:40 ?00:00:00 /usr/bin/postgres -p 50432 -D /var/ericsson/esm-data/postgresql-data/ postgres 490 478 0 13:40 ?00:00:00 postgres: logger process

Re: Inconsistent compilation error

2018-04-19 Thread David G. Johnston
On Wednesday, April 18, 2018, Adrian Klaver wrote: > > Hmm, wonder if there is an oops in the below: > > http://www.pygresql.org/contents/changelog.html > > Version 5.0 (2016-03-20) > Changes in the DB-API 2 module (pgdb): > "SQL commands are always handled as if they

Re: pg_upgrade help

2018-04-19 Thread Fabio Pardi
Hi, while trying to reproduce your problem, i noticed that on my Centos 6 installations Postgres 8.4 and Postgres 9.6 (I do not have 9.4 readily available) store the socket in different places: Postgres 9.6.6 uses /var/run/postgresql/ Postgres 8.4 uses /tmp/ therefore using default settings,

obsoleting plpython2u and defaulting plpythonu to plpython3u

2018-04-19 Thread Pavel Raiskup
Per current plpython docs: The language named plpythonu implements PL/Python based on the default Python language variant, which is currently Python 2. (This default is independent of what any local Python installations might consider to be their “default”, for example, what

Re: pg_upgrade help

2018-04-19 Thread Akshay Ballarpure
Hi Fabio, Yes i ran initdb on new database and able to start as below. [root@ms-esmon root]# su - postgres -c "/usr/bin/postgres -p 50432 -D /var/ericsson/esm-data/postgresql-data/ 2>&1 &" [root@ms-esmon root]# su - postgres -c "/opt/rh/rh-postgresql94/root/usr/bin/postgres -D

Re: New website

2018-04-19 Thread Enrico Pirozzi
Hi Adrian, I had the same problem too, but only on Chrome Regards, Enrico Il 19/04/2018 00:03, Adrian Klaver ha scritto: I would contact the Webmaster but Contact goes to a big image of an elephant head. That is also where Downloads, Support and Donate lands. Might have been a good idea to