Re: updating sequence value for column 'serial'

2019-09-24 Thread Matthias Apitz
El día martes, septiembre 24, 2019 a las 08:01:46a. m. -0700, Adrian Klaver escribió: > On 9/24/19 7:47 AM, Matthias Apitz wrote: > > > > Hello, > > > > We have in a database some 400 tables, 75 of them have a 'serial' > > column, like the one in the example table 'titel_daten', column

Re: Mapping view columns to their source columns

2019-09-24 Thread Matt Andrews
After thinking about this one for a while, I imagined even more nightmarish scenarios than what you've just described here, and mapping the source columns no longer seems like a viable idea. Fortunately, there are a few work arounds I can rely on that particular to our database design, which

Re: Mapping view columns to their source columns

2019-09-24 Thread Tom Lane
Matt Andrews writes: > I'm trying to map view columns to their source columns using the system > catalogs and information schema, but not having much luck. It's easy to > determine which columns a view *depends *on, but not how those columns are > mapped to the columns of the view. It seems like

Re: How to get timezone offset in timestamp with time zone AT TIME ZONE output.

2019-09-24 Thread Andrew Gierth
> "rob" == rob stone writes: rob> You can EXTRACT timezone, timezone_hour and timezone_minute from a rob> timestamp. Using 'timezone' returns a value representing seconds rob> from UTC. Yes, but this always outputs a value representing the server timezone; there's no way (other than the

Re: How to get timezone offset in timestamp with time zone AT TIME ZONE output.

2019-09-24 Thread rob stone
On Wed, 2019-09-25 at 10:12 +1000, Paul McGarry wrote: > > On Wed, Sep 25, 2019 at 5:44 AM Adrian Klaver < > adrian.kla...@aklaver.com> wrote: > > > Andrew's function seems plausible and I need to find some time to > test it, but I am slightly surprised there isn't a native way to get > the

Re: How to get timezone offset in timestamp with time zone AT TIME ZONE output.

2019-09-24 Thread Andrew Gierth
> "Paul" == Paul McGarry writes: > On Wed, Sep 25, 2019 at 5:44 AM Adrian Klaver > wrote: >> >> "Therefore whatever renders the offset needs to be capable of doing >> it per row, independently of the server/session time zone." The key point here is that storing the timestamp as

Mapping view columns to their source columns

2019-09-24 Thread Matt Andrews
Hi, I'm trying to map view columns to their source columns using the system catalogs and information schema, but not having much luck. It's easy to determine which columns a view *depends *on, but not how those columns are mapped to the columns of the view. It seems like the only way to do is

Re: How to get timezone offset in timestamp with time zone AT TIME ZONE output.

2019-09-24 Thread Paul McGarry
On Wed, Sep 25, 2019 at 5:44 AM Adrian Klaver wrote: > > The issue is unclear so I am not sure you can discount this as a > solution. The OP had: > > CREATE TABLE users ( > user_id biginit, > user_timezone text, -- Eg 'Australia/Sydney','Asia/Hong_Kong' > ); > CREATE TABLE data ( > id bigint, >

Re: How to get timezone offset in timestamp with time zone AT TIME ZONE output.

2019-09-24 Thread Adrian Klaver
On 9/23/19 7:40 PM, Andrew Gierth wrote: "Adrian" == Adrian Klaver writes: Adrian> This has come up before and the general suggestion has been to Adrian> have a column for a naive(timestamp w/o tz) timestamp and a Adrian> column for the timezone. No, that's usually (not always)

RE: can't install pg 12 beta on centos 6

2019-09-24 Thread Kevin Brannen
>From: Adrian Klaver >On 9/23/19 2:00 PM, Kevin Brannen wrote: >>> Adrian Klaver wrote: >>> On 9/23/19 12:04 PM, Kevin Brannen wrote: I’ve spun up a new VM with Centos 6.10 (the latest). I found https://yum.postgresql.org/testing/12/redhat/rhel-6-x86_64/repoview/ to get the

Re: pg_terminate_backend not working

2019-09-24 Thread bhargav kamineni
> Hi Team , > > We are observing long running process hung in active state on one of > our db from last two days with usename 'xyz', We have tried killing > the respective pid with pg_terminate_backned(pid), it's returning > true but the quires are not actually being terminated. Based on the >

Re: pg_terminate_backend not working

2019-09-24 Thread Jerry Sievers
bhargav kamineni writes: > Hi Team , > > We are observing long running process hung in active state on one of > our db from last two days with usename 'xyz', We have tried killing > the respective pid with pg_terminate_backned(pid), it's returning > true but the quires are not actually being

Re: Pg_auto_failover

2019-09-24 Thread Sonam Sharma
Hi Rob, I have no where mentioned /backup. I have manually create backup inside / folder to check why it's giving the error. The /backup folder is empty only. On Tue, Sep 24, 2019, 11:15 PM Rob Sargent wrote: > > > > On Sep 24, 2019, at 11:38 AM, Sonam Sharma wrote: > > > > Hi Rob, > > Os :

Re: Pg_auto_failover

2019-09-24 Thread Rob Sargent
> On Sep 24, 2019, at 11:38 AM, Sonam Sharma wrote: > > Hi Rob, > Os : Linux rhel x86_64 > Postgres version : 11.2 > Installed the rpm of pg_auto_failover and then set up the monitor, primary. > Secondary is failing with given error > Well //backup is a valid reference to /backup (double

Re: Pg_auto_failover

2019-09-24 Thread Sonam Sharma
Hi Rob, Os : Linux rhel x86_64 Postgres version : 11.2 Installed the rpm of pg_auto_failover and then set up the monitor, primary. Secondary is failing with given error On Tue, Sep 24, 2019, 10:11 PM Rob Sargent wrote: > > > > On Sep 24, 2019, at 9:41 AM, Sonam Sharma wrote: > > > > I was

Re: pg_terminate_backend not working

2019-09-24 Thread bhargav kamineni
Any thoughts on this ? On Tue, 24 Sep 2019 at 16:44, bhargav kamineni wrote: > Hi Team , > > We are observing long running process hung in active state on one of our > db from last two days with usename 'xyz', We have tried killing the > respective pid with pg_terminate_backned(pid), it's

Re: Pg_auto_failover

2019-09-24 Thread Rob Sargent
> On Sep 24, 2019, at 9:41 AM, Sonam Sharma wrote: > > I was setting up pg_auto_failover. Have successfully set up and monitor and > primary instance. While setting up secondary it's failing with below : > > ERROR Failed to ensure empty directory "//backup" : Permission denied > Error

Re: Pg_auto_failover

2019-09-24 Thread Rob Sargent
> On Sep 24, 2019, at 10:22 AM, Sonam Sharma wrote: > > Can someone please help > > -- Forwarded message - > From: Sonam Sharma mailto:sonams1...@gmail.com>> > Date: Tue, Sep 24, 2019, 9:11 PM > Subject: Pg_auto_failover > To: pgsql-general

Fwd: Pg_auto_failover

2019-09-24 Thread Sonam Sharma
Can someone please help -- Forwarded message - From: Sonam Sharma Date: Tue, Sep 24, 2019, 9:11 PM Subject: Pg_auto_failover To: pgsql-general I was setting up pg_auto_failover. Have successfully set up and monitor and primary instance. While setting up secondary it's failing

Pg_auto_failover

2019-09-24 Thread Sonam Sharma
I was setting up pg_auto_failover. Have successfully set up and monitor and primary instance. While setting up secondary it's failing with below : ERROR Failed to ensure empty directory "//backup" : Permission denied Error Failed initialise standby server , see above for details. Where is it

Re: updating sequence value for column 'serial'

2019-09-24 Thread Adrian Klaver
On 9/24/19 7:47 AM, Matthias Apitz wrote: Hello, We have in a database some 400 tables, 75 of them have a 'serial' column, like the one in the example table 'titel_daten', column 'katkey'. I want to create a SQL script to adjust alls these sequences to the max+1 value in its column after

updating sequence value for column 'serial'

2019-09-24 Thread Matthias Apitz
Hello, We have in a database some 400 tables, 75 of them have a 'serial' column, like the one in the example table 'titel_daten', column 'katkey'. I want to create a SQL script to adjust alls these sequences to the max+1 value in its column after loading the database from CSV file. I found no

Re: Operator is not unique

2019-09-24 Thread PegoraroF10
Nope, seems I didn´t create anything. SELECT * FROM pg_operator WHERE oid = '+(numeric, bigint)'::regoperator; ERROR: operator does not exist: +(numeric, bigint) Ok, I can cast, it works. But why works without casting for you and not for me ? -- Sent from:

Re: Operator is not unique

2019-09-24 Thread Fabrízio de Royes Mello
Em ter, 24 de set de 2019 às 10:52, PegoraroF10 escreveu: > > I don´t know if I did. > I think you did. > PostgreSQL 11.5 (Ubuntu 11.5-1.pgdg16.04+1) on x86_64-pc-linux-gnu, compiled > by gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609, 64-bit > Take a look: postgres=# SELECT version();

Re: Operator is not unique

2019-09-24 Thread Tom Lane
PegoraroF10 writes: > If I do ... > select 1::NUMERIC + 1::BIGINT; > I get ... > [42725] ERROR: operator is not unique: numeric + bigint Hint: Could not > choose a best candidate operator. You might need to add explicit type casts. This doesn't happen for me. > This error means I have more than

Re: Operator is not unique

2019-09-24 Thread PegoraroF10
I don´t know if I did. PostgreSQL 11.5 (Ubuntu 11.5-1.pgdg16.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609, 64-bit -- Sent from: https://www.postgresql-archive.org/PostgreSQL-general-f1843780.html

Re: Operator is not unique

2019-09-24 Thread Fabrízio de Royes Mello
Em ter, 24 de set de 2019 às 10:35, PegoraroF10 escreveu: > > If I do ... > select 1::NUMERIC + 1::BIGINT; > > I get ... > [42725] ERROR: operator is not unique: numeric + bigint Hint: Could not > choose a best candidate operator. You might need to add explicit type casts. > Witch version are

Operator is not unique

2019-09-24 Thread PegoraroF10
If I do ... select 1::NUMERIC + 1::BIGINT; I get ... [42725] ERROR: operator is not unique: numeric + bigint Hint: Could not choose a best candidate operator. You might need to add explicit type casts. This error means I have more than one way to calculate that formula ? Did I create that

pg_terminate_backend not working

2019-09-24 Thread bhargav kamineni
Hi Team , We are observing long running process hung in active state on one of our db from last two days with usename 'xyz', We have tried killing the respective pid with pg_terminate_backned(pid), it's returning true but the quires are not actually being terminated. Based on the client address

RE: Monitor Postgres database status on Docker

2019-09-24 Thread Daulat Ram
Thanks but how we can use it for docker container. Regards, Daulat From: Fan Liu Sent: Tuesday, September 24, 2019 3:02 PM To: Daulat Ram ; pgsql-general@lists.postgresql.org Subject: RE: Monitor Postgres database status on Docker Hi, I am not from PostgreSQL team. Just let you know that when

Re: How to represent a bi-directional list in db?

2019-09-24 Thread Pankaj Jangid
Francisco Olarte writes: > That being said, linked lists are procedural data structures, SQL is > declarative, so they are not a great match, that's one of the reasons > why they are rarely seen. Things like master-detail have less > impedance mismatch. Thanks Francisco. Got the idea. --

RE: Monitor Postgres database status on Docker

2019-09-24 Thread Fan Liu
Hi, I am not from PostgreSQL team. Just let you know that when we run PostgreSQL in Kubernetes, we use below command for liveness check. pg_isready --host localhost -p $PG_PORT -U $PATRONI_SUPERUSER_USERNAME BRs, Fan Liu From: Daulat Ram Sent: Tuesday, September 24, 2019 5:18 PM To:

Monitor Postgres database status on Docker

2019-09-24 Thread Daulat Ram
Hi team, We want to check the postgres database status on docker container just like we monitor Postgres (up / down) via /etc/init.d/postgresql status But I am not sure how we can do that with docker. Thanks, Daulat

Re: How to represent a bi-directional list in db?

2019-09-24 Thread Francisco Olarte
Pankaj: On Mon, Sep 23, 2019 at 4:07 PM Pankaj Jangid wrote: ... > My stages are stages of processes. So yes processes are also stored in a > table. I got the idea. I'll add another column in the processes table > which points to the first stage (first_stage_id). And quries > Forward pass: ... >