Re: schema change tracking

2019-05-16 Thread bricklen
On Thu, May 16, 2019 at 9:41 AM Benedict Holland < benedict.m.holl...@gmail.com> wrote: > I need a tool that can track schema changes in a postgesql database, write > scripts to alter the tables, and store those changes in git. Are there > tools that exist that can do this? > For dev and QA, my

Re: schema change tracking

2019-05-16 Thread Adrian Klaver
On 5/16/19 10:55 AM, Benedict Holland wrote: Hi All! Thanks for the replies. I am looking for a solution, possibly 3rd party, where I write changes to the schema and it keeps track of the changes I made. I am used to doing stuff in pgadmin4 but I don't mind something else. This isn't really

Re: schema change tracking

2019-05-16 Thread Benedict Holland
Hi All! Thanks for the replies. I am looking for a solution, possibly 3rd party, where I write changes to the schema and it keeps track of the changes I made. I am used to doing stuff in pgadmin4 but I don't mind something else. This isn't really ad-hoc. This is more like, I have a v1.0 release

Re: Upgrading 9.1.17 to which version?

2019-05-16 Thread Adrian Klaver
On 5/16/19 10:38 AM, Fabio Ugo Venchiarutti wrote: 11.x would be best, since it's EOL is furthest in the future. 9.6 would be best, because it's had more bug-fix releases. Aren't all important bugfixes backported to every non-EOL affected majors at once? Correct me if I'm wrong but

Re: Upgrading 9.1.17 to which version?

2019-05-16 Thread David G. Johnston
On Thu, May 16, 2019 at 10:38 AM Fabio Ugo Venchiarutti < f.venchiaru...@ocado.com> wrote: > On 16/05/2019 18:20, Ron wrote: > > On 5/16/19 4:36 AM, nigel.ander...@gmx.com wrote: > >> but I wonder whether that might be an easier/more reliable option from > >> an install and point of view and

Re: Permissions for information_schema

2019-05-16 Thread Adrian Klaver
On 5/16/19 9:50 AM, Susan Hurst wrote: What are the correct permissions to give to a role so that all objects in the information_schema (and pg_catalog) are visible to a user? As example: https://www.postgresql.org/docs/11/infoschema-tables.html "... Only those tables and views are shown

Re: Upgrading 9.1.17 to which version?

2019-05-16 Thread Fabio Ugo Venchiarutti
On 16/05/2019 18:20, Ron wrote: On 5/16/19 4:36 AM, nigel.ander...@gmx.com wrote: Hi, I've just inherited an ancient install of 9.1.17 after our tech guy left, on what turns out to be a rapidly dying server and being a total newb to PostgreSQL (and not much more advanced on Linux) I'm a

Re: Permissions for information_schema

2019-05-16 Thread Susan Hurst
The objects are granted SELECT to PUBLIC. --- Susan E Hurst Principal Consultant Brookhurst Data LLC Email: susan.hu...@brookhurstdata.com Mobile: 314-486-3261 On 2019-05-16 11:53, David G. Johnston wrote: > On Thu, May 16, 2019 at 9:50 AM Susan

Re: Upgrading 9.1.17 to which version?

2019-05-16 Thread Ron
On 5/16/19 4:36 AM, nigel.ander...@gmx.com wrote: Hi, I've just inherited an ancient install of 9.1.17 after our tech guy left, on what turns out to be a rapidly dying server and being a total newb to PostgreSQL (and not much more advanced on Linux) I'm a little stuck on the way ahead. I've

Re: schema change tracking

2019-05-16 Thread Mark Fletcher
On Thu, May 16, 2019 at 9:41 AM Benedict Holland < benedict.m.holl...@gmail.com> wrote: > > I need a tool that can track schema changes in a postgesql database, write > scripts to alter the tables, and store those changes in git. Are there > tools that exist that can do this? > > We ended up

Re: Permissions for information_schema

2019-05-16 Thread David G. Johnston
On Thu, May 16, 2019 at 9:50 AM Susan Hurst wrote: > What are the correct permissions to give to a role so that all objects > in the information_schema (and pg_catalog) are visible to a user? > Have you determined that using the underlying pg_catalog schema is not viable. David J.

Re: Upgrading 9.1.17 to which version?

2019-05-16 Thread David G. Johnston
On Thu, May 16, 2019 at 9:36 AM wrote: > Hi, > > I've just inherited an ancient install of 9.1.17 after our tech guy left, > on what turns out to be a rapidly dying server and being a total newb to > PostgreSQL (and not much more advanced on Linux) I'm a little stuck on the > way ahead. > > I've

Re: bigint out of range

2019-05-16 Thread Tony Shelver
Adding to what David said, I don't see much point of having a bigint status. Usually status attributes are a fixed set of values that can be checked programmatically. >

Permissions for information_schema

2019-05-16 Thread Susan Hurst
What are the correct permissions to give to a role so that all objects in the information_schema (and pg_catalog) are visible to a user? Permissions seem to make a difference but I don't know which adjustments to make without causing unintended consequences. We revoked select on all tables

Re: schema change tracking

2019-05-16 Thread Steve Atkins
> On May 16, 2019, at 5:41 PM, Benedict Holland > wrote: > > Hi All, > > I am fairly this question has many answers but here it goes: > > I need a tool that can track schema changes in a postgesql database, write > scripts to alter the tables, and store those changes in git. Are there

schema change tracking

2019-05-16 Thread Benedict Holland
Hi All, I am fairly this question has many answers but here it goes: I need a tool that can track schema changes in a postgesql database, write scripts to alter the tables, and store those changes in git. Are there tools that exist that can do this? BTW, I know if I use a framework with some

Upgrading 9.1.17 to which version?

2019-05-16 Thread nigel . andersen
Hi,   I've just inherited an ancient install of 9.1.17 after our tech guy left, on what turns out to be a rapidly dying server and being a total newb to PostgreSQL (and not much more advanced on Linux) I'm a little stuck on the way ahead.   I've managed to secure a decent new server for a new

Re: bigint out of range

2019-05-16 Thread David G. Johnston
On Thu, May 16, 2019 at 8:31 AM Daulat Ram wrote: > url_hash| bigint | | not null | > Change the type of url_hash; make it text instead of bigint. As a bonus: Use text instead of arbitrary varchar(4000) fields and add, e.g., check (length(url) < 4000) or

Re: bigint out of range

2019-05-16 Thread Geoff Winkless
On Thu, 16 May 2019 at 16:31, Daulat Ram wrote: > Hello team , > > We are getting ERROR: bigint out of range. Please help on this. > > > Bigint is -9223372036854775808 to 9223372036854775807. https://www.postgresql.org/docs/current/datatype-numeric.html

bigint out of range

2019-05-16 Thread Daulat Ram
Hello team , We are getting ERROR: bigint out of range. Please help on this. ERROR: bigint out of range kbdb=# INSERT INTO kb_dar_ran_url_check (url_hash,stat_date,topic_id,site_id,url,status,user_comments,review_comments) VALUES

Re: Returning empty on insert

2019-05-16 Thread Adrian Klaver
On 5/16/19 7:52 AM, Winanjaya Amijoyo wrote: yes you are right!.. the insert was swallowed I tried below: WITH s AS (    SELECT pid,area FROM test WHERE area = '11' ), i AS (    INSERT INTO test (area)    SELECT '11'    WHERE NOT EXISTS (SELECT 1 FROM s)    RETURNING pid ) UPDATE test SET

Re: Returning empty on insert

2019-05-16 Thread Adrian Klaver
On 5/16/19 7:25 AM, Winanjaya Amijoyo wrote: see enclosed screenshot.. I thought, the record still locked that's why it returns empty.. I'm not sure I believe that screenshot. For one I don't know why it showing the area and last_update as they are not being returned? Try the query in psql

Re: Returning empty on insert

2019-05-16 Thread Winanjaya Amijoyo
yes you are right!.. the insert was swallowed I tried below: WITH s AS ( SELECT pid,area FROM test WHERE area = '11' ), i AS ( INSERT INTO test (area) SELECT '11' WHERE NOT EXISTS (SELECT 1 FROM s) RETURNING pid ) UPDATE test SET last_update = CURRENT_TIMESTAMP WHERE pid =

Re: Returning empty on insert

2019-05-16 Thread Winanjaya Amijoyo
I changed the query to: LOCK TABLE test IN EXCLUSIVE MODE; WITH s AS ( SELECT pid,area FROM test WHERE area = 'test123' ), i AS ( INSERT INTO test (area) SELECT ' test123 ' WHERE NOT EXISTS (SELECT 1 FROM s) RETURNING pid ) UPDATE area SET last_update = CURRENT_TIMESTAMP WHERE pid

Re: Returning empty on insert

2019-05-16 Thread Adrian Klaver
On 5/16/19 7:26 AM, Winanjaya Amijoyo wrote: and yes .. I need both inserted pid and updated pid The INSERT pid is going to be 'swallowed' by the CTE that is why the: SELECT pid FROM s UNION SELECT pid FROM i Which also means the UPDATE RETURNING pid will be equal to it. On Thu, May 16,

Re: Returning empty on insert

2019-05-16 Thread Winanjaya Amijoyo
and yes .. I need both inserted pid and updated pid On Thu, May 16, 2019 at 9:25 PM Winanjaya Amijoyo < winanjaya.amij...@gmail.com> wrote: > see enclosed screenshot.. > > I thought, the record still locked that's why it returns empty.. > > On Thu, May 16, 2019 at 9:21 PM Adrian Klaver > wrote:

Re: Returning empty on insert

2019-05-16 Thread Winanjaya Amijoyo
see enclosed screenshot.. I thought, the record still locked that's why it returns empty.. On Thu, May 16, 2019 at 9:21 PM Adrian Klaver wrote: > On 5/16/19 7:10 AM, Winanjaya Amijoyo wrote: > > Hi David, > > > > thanks for your advise, as I am new with postgresql.. > > I try to use LOCK as

Re: Returning empty on insert

2019-05-16 Thread Adrian Klaver
On 5/16/19 7:10 AM, Winanjaya Amijoyo wrote: Hi David, thanks for your advise, as I am new with postgresql.. I try to use LOCK as below, but it does not returning pid? what I missed? I'm not sure which pid you are referring to, the INSERT or UPDATE or both? Can you show the output of the

Re: Returning empty on insert

2019-05-16 Thread Winanjaya Amijoyo
Hi David, thanks for your advise, as I am new with postgresql.. I try to use LOCK as below, but it does not returning pid? what I missed? BEGIN TRANSACTION; LOCK TABLE test IN ACCESS EXCLUSIVE MODE; WITH s AS ( SELECT pid FROM test WHERE area = 'test4' ), i AS ( INSERT INTO test (area)

Re: How to search using daterange (using gist)

2019-05-16 Thread Andreas Kretschmer
Am 16.05.19 um 11:57 schrieb Winanjaya Amijoyo: Hi All, I have records as below that I inserted using exclusion gist constraint user_id    start_date      end_date         pid 001          2019-01-01    2019-02-10        1 001          2019-02-01    2019-03-12        2 001         

How to search using daterange (using gist)

2019-05-16 Thread Winanjaya Amijoyo
Hi All, I have records as below that I inserted using exclusion gist constraint user_idstart_date end_date pid 001 2019-01-012019-02-101 001 2019-02-012019-03-122 001 2019-03-052019-06-153 I need to find records

Re: Returning empty on insert

2019-05-16 Thread David Rowley
On Thu, 16 May 2019 at 21:13, Winanjaya Amijoyo wrote: > When record not found then insert and return pid value or if not found then > update based on pid and again return its pid. You could do something like: WITH s AS ( SELECT pid FROM test WHERE area = 'test5' ), i AS ( INSERT INTO

Re: Returning empty on insert

2019-05-16 Thread Winanjaya Amijoyo
Hi What I want to archive here is: When record not found then insert and return pid value or if not found then update based on pid and again return its pid. Please help. Many thanks in advance. Regards Win On Thu, 16 May 2019 at 15.47 David Rowley wrote: > On Thu, 16 May 2019 at 20:28,

Re: Returning empty on insert

2019-05-16 Thread David Rowley
On Thu, 16 May 2019 at 20:28, Winanjaya Amijoyo wrote: > column pid is bigserial that I expect to return on both insert and update > I don't want to use ON CONFLICT since it would increasing the sequence > although it updating the data It's not very clear what you're trying to do here. So, by

Re: Returning empty on insert

2019-05-16 Thread Winanjaya Amijoyo
column pid is bigserial that I expect to return on both insert and update I don't want to use ON CONFLICT since it would increasing the sequence although it updating the data On Thu, May 16, 2019 at 3:26 PM David Rowley wrote: > On Thu, 16 May 2019 at 19:56, Winanjaya Amijoyo > wrote: > > when

Re: Returning empty on insert

2019-05-16 Thread David Rowley
On Thu, 16 May 2019 at 19:56, Winanjaya Amijoyo wrote: > when running query below, pid returns empty when inserting new record > > WITH s AS ( >SELECT pid FROM test WHERE area = 'test5' > ), i AS ( >INSERT INTO test (area) >SELECT 'test5' >WHERE NOT EXISTS (SELECT 1 FROM s) >

Returning empty on insert

2019-05-16 Thread Winanjaya Amijoyo
Hi all, when running query below, pid returns empty when inserting new record WITH s AS ( SELECT pid FROM test WHERE area = 'test5' ), i AS ( INSERT INTO test (area) SELECT 'test5' WHERE NOT EXISTS (SELECT 1 FROM s) RETURNING pid ) UPDATE area SET last_update = CURRENT_TIMESTAMP

Re: terminating walsender process due to replication timeout

2019-05-16 Thread Kyotaro HORIGUCHI
Hello. At Wed, 15 May 2019 10:04:12 +0300, ayaho...@ibagroup.eu wrote in > Hello, > Thank You for the response. > > Yes that's possible to monitor replication delay. But my questions were > not about monitoring network issues. > > I use exactly wal_sender_timeout=1s because it allows to