Re: Converting to identity columns with domains on PK columns

2019-07-05 Thread Adrian Klaver
On 7/5/19 3:32 PM, Tom Lane wrote: Adrian Klaver writes: On 7/5/19 1:49 PM, PegoraroF10 wrote: Sorry, the example I was thinking was this one, which works on Firebird, using its way of writing, obviously. create function myproc(id integer) returns I32 language sql as 'select $1'; On postgres

Re: Converting to identity columns with domains on PK columns

2019-07-05 Thread Tom Lane
Adrian Klaver writes: > On 7/5/19 1:49 PM, PegoraroF10 wrote: >> Sorry, the example I was thinking was this one, which works on Firebird, >> using its way of writing, obviously. >> create function myproc(id integer) returns I32 language sql as 'select $1'; >> >> On postgres ERROR: return type mis

Re: Converting to identity columns with domains on PK columns

2019-07-05 Thread Adrian Klaver
On 7/5/19 1:55 PM, PegoraroF10 wrote: - Because we don´t need to give rigths to user on sequences; - Nobody will change values of pk fields, because we would like to have GENERATE ALWAYS on those PK Fields. An IDENTITY column is still backed by a sequence: create table identity_test(id integer

Re: Converting to identity columns with domains on PK columns

2019-07-05 Thread Adrian Klaver
On 7/5/19 1:49 PM, PegoraroF10 wrote: Sorry, the example I was thinking was this one, which works on Firebird, using its way of writing, obviously. create function myproc(id integer) returns I32 language sql as 'select $1'; On postgres ERROR: return type mismatch in function declared to return

Re: Converting to identity columns with domains on PK columns

2019-07-05 Thread PegoraroF10
- Because we don´t need to give rigths to user on sequences; - Nobody will change values of pk fields, because we would like to have GENERATE ALWAYS on those PK Fields. -- Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html

Re: Partitioning an existing table - pg10.6

2019-07-05 Thread Michael Lewis
I have not personally used this, but the write-up seems solid to minimize downtime to help you to shift data gradually. Be sure you understand the limitations of partitioning, particularly when you are still on 10x not yet on v11 where updates will shift a row to a new partition if the partition ke

Re: Converting to identity columns with domains on PK columns

2019-07-05 Thread PegoraroF10
Sorry, the example I was thinking was this one, which works on Firebird, using its way of writing, obviously. create function myproc(id integer) returns I32 language sql as 'select $1'; On postgres ERROR: return type mismatch in function declared to return i32 What I mean is that Firebird sees I

Re: Partitioning an existing table - pg10.6

2019-07-05 Thread legrand legrand
Hello, Trying to do what I suggested, I understood it doesn't work ;o( Logical replication can only work between two distinct databases, and it seems that the replicated table name is the same as its source ... Regards PAscal -- Sent from: http://www.postgresql-archive.org/PostgreSQL-general-

Re: Converting to identity columns with domains on PK columns

2019-07-05 Thread Adrian Klaver
On 7/5/19 1:01 PM, PegoraroF10 wrote: Adrian, on Firebird if you create a table or procedure with fields or params declared with domains, they can be used with those domains or with their base type. On Postgres I32 is not equal to integer. create procedure myproc(id i32) returns(x i32) as ... s

Re: Converting to identity columns with domains on PK columns

2019-07-05 Thread Tom Lane
PegoraroF10 writes: > Adrian, on Firebird if you create a table or procedure with fields or params > declared with domains, they can be used with those domains or with their > base type. On Postgres I32 is not equal to integer. > create procedure myproc(id i32) returns(x i32) as ... > select *

Re: Converting to identity columns with domains on PK columns

2019-07-05 Thread PegoraroF10
Adrian, on Firebird if you create a table or procedure with fields or params declared with domains, they can be used with those domains or with their base type. On Postgres I32 is not equal to integer. create procedure myproc(id i32) returns(x i32) as ... select * from myproc(cast(5 as integer))

xpath differences between postgres 11.4 and 10.3

2019-07-05 Thread Felipe de Jesús Molina Bravo
Hi!! I have an strange behavior between 11.4 and 10.3 with xpath function: With pgsql 10.3 i have: select xpath('@idc', '' ) ; xpath {4776} (1 fila) and with pgsql 11.4: select xpath('@idc', ''::xml ) ; xpath --- {} (1 fila) Now, if change the expression wi

Re: PostgreSQL upgrade from 9.4.2 to 9.6.12

2019-07-05 Thread Michael Lewis
This may also be of interest to you, but checking official docs as Adrian recommended is best. https://why-upgrade.depesz.com/show?from=9.4.2&to=9.6.12&keywords=

Re: Converting to identity columns with domains on PK columns

2019-07-05 Thread Adrian Klaver
On 7/5/19 4:38 AM, PegoraroF10 wrote: Well, I think it´ll not as easy as you said. That tables has dependencies. So, if I try to alter type it gives me ERROR: cannot alter type of a column used in a trigger definition. I dropped all Triggers of that table and it gives me ERROR: cannot alter type

Re: Active connections are terminated because of small wal_sender_timeout

2019-07-05 Thread Tom Lane
ayaho...@ibagroup.eu writes: > Do you have any thoughts regarding this issue? I do not think anybody thinks this is a bug. Setting wal_sender_timeout too small is a configuration mistake. regards, tom lane

Re: Vacuum and freeing dead rows

2019-07-05 Thread Ron
On 7/5/19 3:16 AM, Simon T wrote: Hi, I have a very heavily updated table in a Postgres 9.6.10 database with lots of disk bloat. Every row is updated about once a minute, and little to no inserts. Approx 18k rows total. The table has bloated from ~1700 KB to about 6 GB over a few weeks time. I'm

Re: Unavailability of Jar for connectivity in Postgres

2019-07-05 Thread Adrian Klaver
On 7/5/19 5:35 AM, Abraham, Nikhil (COR), Vodafone Idea wrote: Dear Team, Good Wishes. We are planning to migrate one of our critical applications from Oracle to 11.1 Postgresql. The UI of the application calls lots of PL/SQL procedures. In order to have that calling facility there is a jar

Unavailability of Jar for connectivity in Postgres

2019-07-05 Thread Abraham, Nikhil (COR), Vodafone Idea
Dear Team, Good Wishes. We are planning to migrate one of our critical applications from Oracle to 11.1 Postgresql. The UI of the application calls lots of PL/SQL procedures. In order to have that calling facility there is a jar provided by the respective databases. Currently the ODBS-JDBC conn

Re: Active connections are terminated because of small wal_sender_timeout

2019-07-05 Thread AYahorau
Hello Everyone! Do you have any thoughts regarding this issue? Best regards, Andrei Yahorau From: Andrei Yahorau/IBA To: pgsql-gene...@postgresql.org, Date: 21/06/2019 11:14 Subject:Active connections are terminated because of small wal_sender_timeout Hello PostgreSQL Comm

Re: Error: rows returned by function are not all of the same row type

2019-07-05 Thread Joe Conway
On 7/5/19 5:39 AM, Andrey Sychev wrote: > Thank you very much for answering my question, Tom. > Yes, I have always assumed that returning from function without > calling SPI_freetuptable is not good idea, but I do not know another > way to achieve same result. Please do not top post on t

Re: Why does jsonb_set() remove non-mentioned keys?

2019-07-05 Thread Peter J. Holzer
On 2019-07-05 10:59:31 +0200, Thomas Kellerer wrote: > Gianni Ceccarelli schrieb am 05.07.2019 um 10:00: > >> strict functions with sql null inputs yield sql null output without > >> even executing the function > > > > So when the SQL-level executor sees a call to any function declared > > strict

Re: Converting to identity columns with domains on PK columns

2019-07-05 Thread PegoraroF10
Well, I think it´ll not as easy as you said. That tables has dependencies. So, if I try to alter type it gives me ERROR: cannot alter type of a column used in a trigger definition. I dropped all Triggers of that table and it gives me ERROR: cannot alter type of a column used by a view or rule. The

Re: postgres 11 issue?

2019-07-05 Thread Steve Rogerson
On 03/07/2019 20:36, Tom Lane wrote: > > It looks like what's happening is that the result of my_from_local() > is being stored into the table as an anonymous record value rather > than a value of type my_timestamp. (The originating session can figure > out what the anonymous record type is, but n

Re: Error: rows returned by function are not all of the same row type

2019-07-05 Thread Andrey Sychev
Thank you very much for answering my question, Tom. Yes, I have always assumed that returning from function without calling SPI_freetuptable is not good idea, but I do not know another way to achieve same result. As I am not expert in PostgreSQL internals and mostly work according to of

Re: Why does jsonb_set() remove non-mentioned keys?

2019-07-05 Thread Thomas Kellerer
Gianni Ceccarelli schrieb am 05.07.2019 um 10:00: >> strict functions with sql null inputs yield sql null output without >> even executing the function > > So when the SQL-level executor sees a call to any function declared > strict with some NULL parameters, it doesn't call the function at > all.

Vacuum and freeing dead rows

2019-07-05 Thread Simon T
Hi, I have a very heavily updated table in a Postgres 9.6.10 database with lots of disk bloat. Every row is updated about once a minute, and little to no inserts. Approx 18k rows total. The table has bloated from ~1700 KB to about 6 GB over a few weeks time. I'm trying to understand why vacuum has

Re: Why does jsonb_set() remove non-mentioned keys?

2019-07-05 Thread Gianni Ceccarelli
Aha! I had mis-understood how "strict"-ness works. Thank you David for the explanation! Thomas: the two main pieces are these: > SQL null and json null are represented differently As far as SQL is concerned, `'null'::jsonb` is a valid (non-`NULL`) value. The SQL part of Postgres doesn't "look i

Re: Converting to identity columns with domains on PK columns

2019-07-05 Thread Laurenz Albe
PegoraroF10 wrote: > Domains on Postgres are really strange to me. Am I creating a domain which is > exactly equal to integer, right ? > > create domain i32 as integer; > create domain T50 as varchar(50); > > Create table MyTable( > ID I32 not null primary key, > Description T50); > > Then, afte