Re: Fixing set-returning functions are not allowed in UPDATE after upgrade to Postgres 12

2020-04-03 Thread David G. Johnston
On Thu, Apr 2, 2020 at 11:38 PM Andrus wrote: > Hi! > > >Simply replace > > SET col = unnest(array_value) > >with > > > > SET col = array_value[1] > > I tried > > > update temprid set > ContactFirstName =xpath( > > > '/E-Document/Document/DocumentParties/BuyerParty/ContactData/ContactF

Re: Database Cache Hit Ratio (Warning)

2020-04-03 Thread David G. Johnston
On Fri, Apr 3, 2020 at 5:17 AM Rajiv Ranjan wrote: > Does this unnamed monitoring tool (and undefined query) really think > higher percentages are worse or are you mis-communicating? > > Forget about the tool used for monitoring, important is to monitor the > "Cache hit ratio" is good or we can i

Re: psql show me the : and ask user input, when running one sql file

2020-04-05 Thread David G. Johnston
On Sun, Apr 5, 2020 at 5:50 AM arden liu wrote: > I am using psql to run this sql file( > https://github.com/Arelle/Arelle/blob/master/arelle/plugin/xbrlDB/sql/public/xbrlPublicPostgresDB.ddl > ) > here is my command: > /usr/bin/psql postgresql://db_user:dbpassword@localhost:5432/my_db -f > /tmp/

Re: psql show me the : and ask user input, when running one sql file

2020-04-05 Thread David G. Johnston
On Sun, Apr 5, 2020 at 7:47 AM Tim Clarke wrote: > Your first argument is a JDBC connection string (see here > https://jdbc.postgresql.org/documentation/80/connect.html). To provide > the details when using the command line psql command, use the -h, -p and > -U parameters (https://www.postgresql.

Re: How to unnest nested arrays

2020-04-06 Thread David G. Johnston
On Mon, Apr 6, 2020 at 6:12 PM Guyren Howe wrote: > Consider this: > > *select* (*array*[*array*[1, 2], *array*[3, 4]])[i:i] > *from* *generate_subscripts*(*array*[*array*[1, 2], *array*[3, 4]], 1) i > > which produces: > > {{1,2}} > {{3,4}} > > I expect and want, from that source: > > {1, 2} > {

Re: extract property value from set of json arrays

2020-04-06 Thread David G. Johnston
On Mon, Apr 6, 2020 at 7:21 PM AC Gomez wrote: > I have the following in a postgresql table > row 1: {"a": 1, "b": "[{"c": "123", "d":"456", "e": "789"}, {"c": "222", > "d":"111", "e": "000"} ]"} > row 2: {"a": 2, "b": "[{"c": "XXX", "d":"YYY", "e": "ZZZ"}, {"c": "666", > "d":"444", "e": "333"}

Re: what happens when you issue ALTER SERVER in a hot environment?

2020-04-06 Thread David G. Johnston
On Monday, April 6, 2020, AC Gomez wrote: > If you issue an ALTER SERVER command and there are active connections > with that server in use or new ones are coming in, what happens? Docs on > this command say nothing regarding active processing using the server > context and changes to it. So I a

Re: order by not working in view ?

2020-04-09 Thread David G. Johnston
On Thursday, April 9, 2020, David Gauthier wrote: > psql (9.6.7, server 11.3) on linux > > In the copy/paste below, first 2 lines returned by a select on the view, > why didn't it sort on start_datetime correctly ? I would think that the > one started on 04-08 would come before the one on 04-09

Re: timestamp and timestamptz

2020-04-15 Thread David G. Johnston
On Wed, Apr 15, 2020 at 4:53 PM raf wrote: > I don't see much difference in storing a timestamptz in UTC or a > timestamptz > in CET. As long as the intended offset from UTC is recorded (which it is > in a timestamptz) it should be fine. > I only really skimmed the entire response but this frami

Re: how to slow down parts of Pg

2020-04-21 Thread David G. Johnston
On Tue, Apr 21, 2020 at 2:25 PM Kevin Brannen wrote: > Sometimes I need the disk space back. It also makes me feel better. (OK, > this may not a good reason but there is a hint of truth in this.) What this > probably means is that I need to get a better understanding of vacuuming. > Imagine you

Re: parameter limit

2020-04-23 Thread David G. Johnston
On Thursday, April 23, 2020, Adrian Klaver wrote: > On 4/23/20 7:33 AM, Scott Ribe wrote: > >> In libpq, PQexecParams has nParams as type int. So on any reasonable >> platform, that's at least 4 bytes. My question then is: when I see >> documented limits of 65535 params in various drivers and lib

Re: relationship of backend_start, query_start, state_change

2020-04-23 Thread David G. Johnston
On Thu, Apr 23, 2020 at 9:37 AM Si Chen wrote: > Hello, > > I'm looking at my pg_stat_activity and trying to figure out what is > causing some of these processes. I'm using this query: > > SELECT pid, wait_event, state_change, backend_start, xact_start, > query_start, state_change - query_start,

Re: relationship of backend_start, query_start, state_change

2020-04-23 Thread David G. Johnston
On Thu, Apr 23, 2020 at 9:55 AM David G. Johnston < david.g.johns...@gmail.com> wrote: > On Thu, Apr 23, 2020 at 9:37 AM Si Chen > wrote: > >> Hello, >> >> I'm looking at my pg_stat_activity and trying to figure out what is >> causing some of these pr

Re: relationship of backend_start, query_start, state_change

2020-04-23 Thread David G. Johnston
On Thu, Apr 23, 2020 at 9:58 AM Olivier Gautherot wrote: > Hi David, > > On Thu, Apr 23, 2020 at 6:55 PM David G. Johnston < > david.g.johns...@gmail.com> wrote: > >> On Thu, Apr 23, 2020 at 9:37 AM Si Chen >> wrote: >> >>> Hello, >>> &g

Re: Could Not Connect To Server

2020-04-23 Thread David G. Johnston
On Thu, Apr 23, 2020 at 11:18 AM Dummy Account wrote: > > Trying to start the server, I navigate too: /Library/PostgreSQL/12/bin > > from bin, I ran: sudo -u postgres ./pg_ctl start -D > /Library/PostgreSQL/12/data > > pg_ctl: could not start server > > > What do the logs say... When I ran the

Re: Ned to understand why all the idle connections

2020-04-23 Thread David G. Johnston
On Thursday, April 23, 2020, David Gauthier wrote: > Hi: > > psql (9.6.7, server 11.3) on linux > > I have what appear to be a log of idle connections to my DB. Query of > pg_stat_activity indicates well over half (127/206) are like this... > > > dvdb=# select state_change,wait_event_type,wait_e

Re: Could Not Connect To Server

2020-04-23 Thread David G. Johnston
On Thu, Apr 23, 2020 at 11:48 AM Dummy Account wrote: > But here they are: > > waiting for server to start2020-04-22 15:57:51.766 CDT [5255] LOG: > starting PostgreSQL 12.2 on x86_64-apple-darwin, compiled by Apple LLVM > version 6.0 (clang-600.0.54) (based on LLVM 3.5svn), 64-bit > 2020-04

Re: Ned to understand why all the idle connections

2020-04-23 Thread David G. Johnston
On Thu, Apr 23, 2020 at 11:52 AM David Gauthier wrote: > Thanks! > And an example of connection pooling is pgBouncer ? > >> >> It does describe itself as being a "Lightweight connection pooler for PostgreSQL" ... https://www.pgbouncer.org/ David J.

Re: Question on banner display after PG initial connection

2020-04-23 Thread David G. Johnston
On Thu, Apr 23, 2020 at 2:07 PM Lu, Dan wrote: > Hello PostgreSQL Admin, > > > > I am fairly new to PostgreSQL. I am a curious question regarding the > banner message displayed after connecting to version 12.1 of PostgreSQL. > > > > Is there a way to get rid of this line “*SSL connection (protoc

Re: Ned to understand why all the idle connections

2020-04-23 Thread David G. Johnston
Please don't top-post; and this is a fairly rude hijack posting given that you already have a thread going, from today no less, where you've basically asked this very same question. On Thu, Apr 23, 2020 at 2:18 PM Si Chen wrote: > Hello David & David, > > I have a similar problem -- a lot of idl

Re: Fw: Re: Could Not Connect To Server

2020-04-23 Thread David G. Johnston
On Thu, Apr 23, 2020 at 3:03 PM Dummy Account wrote: > > I cannot login into a postgres role via command line. > > Issue #1. > I have never done it before via command line, so maybe I am doing it > incorrectly. > I have been attempting to go: > > su - postgres > > The "sudo" in Rob's answer wasn'

Re: psql \copy

2020-04-24 Thread David G. Johnston
On Fri, Apr 24, 2020 at 8:55 AM Steve Clark wrote: > Hello, > > I am using psql to copy data extracted from an InfluxDB in csv format into > postgresql. > I have a key field on the time field which I have defined as a bigint > since the time I get > from InfluxDB is an epoch time. > > My question

Re: Detecting renamed columns via pgouput in logical replication ?

2020-04-26 Thread David G. Johnston
On Thursday, April 16, 2020, Andreas Andreakis wrote: > > > Does this allow to detect column renames ? > “The database schema and DDL commands are not replicated“ https://www.postgresql.org/docs/current/logical-replication-restrictions.html David J.

Re: Detecting renamed columns via pgouput in logical replication ?

2020-04-27 Thread David G. Johnston
Please don’t top-post. On Monday, April 27, 2020, Andreas Andreakis wrote: > Thx for replying David. > > According to https://www.postgresql.org/docs/10/protocol-logicalrep- > message-formats.html it looks like certain schema information is embedded > via pgoutput such as column names and types.

Re: Detecting renamed columns via pgouput in logical replication ?

2020-04-27 Thread David G. Johnston
On Monday, April 27, 2020, David G. Johnston wrote:. > > > Are there plans to add comprehensive schema change detection abilities via >> logical replication ? either by embedding more information into pgoutput or >> perhaps by embedding the schema DDLs ? >> > >

Re: Why is a check constraint not working ?

2020-04-29 Thread David G. Johnston
On Wed, Apr 29, 2020 at 8:17 AM David Gauthier wrote: > > Check constraints: > "dvm_events_status_check" CHECK (status::text = ANY > (ARRAY['passed'::character varying, 'failed'::character varying, > NULL::character varying]::text[])) > > > What could cause this ? > NULL in the array. "stat

Re: Checking for Presence of Required Libraries Fails during PostgreSQL Upgrade

2020-05-02 Thread David G. Johnston
On Sat, May 2, 2020 at 12:31 AM TalGloz wrote: > Adrian Klaver-4 wrote > > On 5/1/20 3:39 PM, TalGloz wrote: > >> Adrian Klaver-4 wrote > >>> Why not compile them against 11? > >>> > >>> Then follow step 5) here: > >>> > >>> https://www.postgresql.org/docs/12/pgupgrade.html > > 2. How to upgrade

Re: jsonb unique constraints

2020-05-05 Thread David G. Johnston
On Tue, May 5, 2020 at 8:33 AM Ted Toth wrote: > Can you have unique constraints on jsonb columns keys? I've looked for > examples but haven't found any what is the proper syntax? Here's what I > tried: > > CREATE TABLE report_json ( > recnum int, > id integer, > report jsonb, > P

Re: Wrong PostgreSQL Plan

2020-05-05 Thread David G. Johnston
On Tue, May 5, 2020 at 6:15 PM Virendra Kumar wrote: > Optimizer is behaving little weird in the sense that for change in one > filter > You mean when you change the date equality filter to a more recent date? > it is using NESTED LOOP JOIN and running for over 30 seconds whereas for > other f

Re: New Role drop with Grant/Revokes stop working after subsequent runs

2020-05-06 Thread David G. Johnston
On Wed, May 6, 2020 at 5:05 PM AC Gomez wrote: > We have developed some code that creates a new role to be used as the main > role for DB usage. This code will be called on a predetermined frequency to > act a role/pwd rotation mechanism. > > Each time the code is run we feed it the prior role t

Re: Explain plan changes - IN CLAUSE ( Passing direct values Vs INNER Query )

2020-05-07 Thread David G. Johnston
On Thu, May 7, 2020 at 7:40 AM Adrian Klaver wrote: > On 5/7/20 4:19 AM, Amarendra Konda wrote: > > Hi, > > > > PostgreSQL version : PostgreSQL 9.6.2 on x86_64-pc-linux-gnu, compiled > > by gcc (GCC) 4.8.3 20140911 (Red Hat 4.8.3-9), 64-bit > > > > We have noticed huge difference interms of execu

Re: Postgres 11.6-2 to 11.7 worth the upgrade?

2020-05-07 Thread David G. Johnston
On Thu, May 7, 2020 at 8:58 AM Jasen Lentz wrote: > > > Would upgrading from 11.6-2 to 11.7-current give us any performance > advantages? We are seeing intermittent performance problems that come and > go. Also are there any fixes for the wal_sender and pg_basebackup between > the versions? >

Re: wal_sender_timeout default

2020-05-07 Thread David G. Johnston
On Thu, May 7, 2020 at 8:56 AM Jasen Lentz wrote: > In Postgres 11.6-2, what is the default timeout for wal_sender_timeout if > it is commented out? > > > The same value you would get if you uncommented the commented out setting... Also the value you would get by querying the database while the

Re: Explain plan changes - IN CLAUSE ( Passing direct values Vs INNER Query )

2020-05-07 Thread David G. Johnston
On Thu, May 7, 2020 at 10:49 AM Amarendra Konda wrote: > Can you please explain, why it is getting more columns in output, even > though we have asked for only one column ? > > > > * Output: pa.process_activity_id, pa.process_activity_type, pa.voice_url, > pa.process_activity_user_id, pa.app_id,

Re: Explain plan changes - IN CLAUSE ( Passing direct values Vs INNER Query )

2020-05-07 Thread David G. Johnston
On Thu, May 7, 2020 at 11:07 AM Amarendra Konda wrote: > EXPLAIN (ANALYZE, COSTS, VERBOSE, BUFFERS) SELECT pa.process_activity_id > AS pa_process_activity_id FROM process_activity pa WHERE pa.app_id = > '126502930200650' AND pa.created > '1970-01-01 00:00:00' AND EXISTS ( > SELECT 1 FROM proce

Re: Best way to use trigger to email a report ?

2020-05-08 Thread David G. Johnston
On Fri, May 8, 2020 at 9:26 AM David Gauthier wrote: > psql (9.6.0, server 11.3) on linux > > Looking for ideas. I want a trigger to... > 1) compose an html report based on DB content > 2) email the report to a dist list (dl = value of a table column) > > If this will involve hybrid coding, I pr

Re: Thoughts on how to avoid a massive integer update.

2020-05-08 Thread David G. Johnston
On Mon, May 4, 2020 at 2:33 PM Fehrle, Brian wrote: > I NEED to update every single row in all these tables, changing the > integer value to a different integer. > > > Does anyone have any hackery ideas on how to achieve this in less time? > Probably the only solution that would perform computa

Re: Best way to use trigger to email a report ?

2020-05-08 Thread David G. Johnston
On Fri, May 8, 2020 at 10:19 AM Christophe Pettus wrote: > If you don't want to periodically poll the table, you can use NOTIFY > within the trigger to wake up a process that is waiting on NOTIFY. > Kinda. "With the libpq library, the application issues LISTEN as an ordinary SQL command, and th

Re: Thoughts on how to avoid a massive integer update.

2020-05-08 Thread David G. Johnston
On Fri, May 8, 2020 at 12:49 PM Rob Sargent wrote: > Well as I said, I think you could add a column to info_table > > alter table info_table add orig_id int; > update info_table set orig_id = info_table_sid; > > update info_table set info_table_sid = 456 where info_table_sid = 456; > > huh? alte

Re: Thoughts on how to avoid a massive integer update.

2020-05-08 Thread David G. Johnston
On Fri, May 8, 2020 at 1:41 PM Rob Sargent wrote: > My understanding is the keys in the info_table need to change. That > causes the very expensive update in the update in the data tables. No? > The keys in the info_table need to change because their contents are no longer legal to be stored (O

Re: Thoughts on how to avoid a massive integer update.

2020-05-08 Thread David G. Johnston
On Fri, May 8, 2020 at 1:51 PM Rob Sargent wrote: > > On May 8, 2020, at 2:43 PM, David G. Johnston > wrote: > > On Fri, May 8, 2020 at 1:41 PM Rob Sargent wrote: > >> My understanding is the keys in the info_table need to change. That >> causes the very expensi

Re: How to restore database to previous state

2020-05-10 Thread David G. Johnston
On Sun, May 10, 2020 at 2:43 PM Andrus wrote: > Is there simpler solution, e.q reverse playback of wal segments starting > from current data directory contents. > There is no "unwind" or "undo" capability in PostgreSQL. You need to separately get the database state to a point sometime before th

Re: Enforcing uniqueness on [real estate/postal] addresses

2020-05-11 Thread David G. Johnston
On Mon, May 11, 2020 at 9:56 AM Peter Devoy wrote: > I need to store addresses for properties (as in real estate) so in my > naivety I created a unique constraint like this: > > ALTER TABLE properties > ADD CONSTRAINT is_unique_address > UNIQUE ( > description, --e.g. Land north o

Re: Is there a significant difference in Memory settings between 9.5 and 12

2020-05-11 Thread David G. Johnston
On Monday, May 11, 2020, Tory M Blue wrote: > I'll keep digging, but i'm hesitant to do my multiple TB db's with half of >>> their shared buffer configs, until I understand what 12 is doing >>> differently than 9.5 >> >> Maybe run your test suite on 9.6, 10, and 11 to see if it is indeed new to 1

Re: Is there a significant difference in Memory settings between 9.5 and 12.

2020-05-11 Thread David G. Johnston
On Monday, May 11, 2020, Tory M Blue wrote: > > > And just to repeat. Same exact hardware, same kernel, nothing more than > installing the latest postgres12, copying my config files from 9.5 to 12 > and running the pg_upgrade. > You’ll want to remove the pg_upgrade from the equation and try v12

Re: Is there a significant difference in Memory settings between 9.5 and 12

2020-05-11 Thread David G. Johnston
Repost, edited subject by mistake... On Monday, May 11, 2020, Tory M Blue wrote: > > And just to repeat. Same exact hardware, same kernel, nothing more than > installing the latest postgres12, copying my config files from 9.5 to 12 > and running the pg_upgrade. > You’ll want to remove the pg_upg

Re: Is there a significant difference in Memory settings between 9.5 and 12

2020-05-11 Thread David G. Johnston
On Monday, May 11, 2020, David G. Johnston wrote: > Repost, edited subject by mistake... > > On Monday, May 11, 2020, Tory M Blue wrote: >> >> And just to repeat. Same exact hardware, same kernel, nothing more than >> installing the latest postgres12, copying my

Re: Why is it that “aggregate functions are not allowed in FROM clause of their own query level”?

2020-05-13 Thread David G. Johnston
On Wednesday, May 13, 2020, Tom Ellis wrote: > Hello, > > The code under 1 gives me the error message "aggregate functions are > not allowed in FROM clause of their own query level" whereas the code > under 2 is permitted. Unless I am much mistaken the latter is > equivalent to the former because

Reuse an existing slot with a new initdb

2020-05-13 Thread David G. Johnston
On Wednesday, May 13, 2020, Michael Paquier wrote: > On Wed, May 13, 2020 at 02:12:45PM -0700, live-school support wrote: > > I didn't recal that it was not possible to create a hot standby with a > fresh > > new install and pg_dumpall :(. > > > > only pg_basebackup or an exact copy of the data f

Re: Bug on version 12 ?

2020-05-15 Thread David G. Johnston
On Fri, May 15, 2020 at 8:27 AM Michael Lewis wrote: > Just wonder, have you compared these on the two servers? > > select * from pg_settings where name = 'DateStyle'; > The OP is using to_timestamp, the DateStyle setting is immaterial. David J.

Re: Bug on version 12 ?

2020-05-15 Thread David G. Johnston
On Fri, May 15, 2020 at 8:08 AM PegoraroF10 wrote: > select To_Json(Current_Timestamp); > returns "2020-05-15T14:49:44.266342+00:00" on version 11.7 or 12.3 > > So I have lots of JSONS which have timestamp on them. > > select > JS ->> 'mydate'::text, > to_timestamp((JS ->> 'mydate'), '-MM

Re: schema agnostic functions in language sql

2020-05-15 Thread David G. Johnston
On Fri, May 15, 2020 at 4:07 PM Rob Sargent wrote: > I'm terribly sorry: I needed to add that plpgsql works without any > knowledge of the schema, where as defining a plain sql functions does > not work without schema qualification. > You need to distinguish between "works" as in "compiles" and

Re: schema agnostic functions in language sql

2020-05-16 Thread David G. Johnston
On Sat, May 16, 2020 at 5:15 AM Rob Sargent wrote: > check_function_body=off may be what I want during the site install as the > definitions should be correct in all aspects. > You should probably just have one "test" schema and compile your functions with the non-client test schema in the searc

Re: Suggestion on index creation for TEXT data field

2020-05-21 Thread David G. Johnston
On Thu, May 21, 2020 at 7:28 AM postgann2020 s wrote: > which is having an avg width of 149bytes. > The average is meaningless if your maximum value exceeds a limit. 2. What type of index is the best suited for this type of data?. > And what type of data exactly are we talking about. "TEXT" i

Re: Suggestion on index creation for TEXT data field

2020-05-21 Thread David G. Johnston
On Thu, May 21, 2020 at 7:45 AM postgann2020 s wrote: > >And what type of data exactly are we talking about. ==> Column is > stroing GIS data. > GIS data isn't really TEXT and isn't a core datatype of PostgreSQL so this is maybe better posted to the PostGIS community directly... David J.

Re: Should I use JSON?

2020-05-21 Thread David G. Johnston
On Thu, May 21, 2020 at 8:37 AM stan wrote: > So here is the question, should I just manually parse this data, as I have > been doing to insert into appropriate entities into the database? Or > should I > insert the JSON data, and use some queries in the database to populate my > tables from the

Re: Query returns no rows in pg_basebackup cluster

2020-05-21 Thread David G. Johnston
On Thu, May 21, 2020 at 3:57 PM Adrian Klaver wrote: > On 5/21/20 3:47 PM, Tom Lane wrote: > > Adrian Klaver writes: > >> On 5/21/20 1:20 PM, Andrus wrote: > >>> In windows pg_basebackup was used to create base backup from Linux > server. > > > >> Are you referring to two different instances of

Re: Query returns no rows in pg_basebackup cluster

2020-05-21 Thread David G. Johnston
On Thu, May 21, 2020 at 10:41 PM Andrus wrote: > Main server is in Linux and backup server is in windows. > This is not a supported setup if you want to run a physical backup. Your backup and your primary need to be the same - software and hardware. Consider anything that is working to be a fal

Re: Suggestion to improve query performance of data validation in proc.

2020-05-22 Thread David G. Johnston
You should read through the and the contained linked FAQ - note especially the concept and recommendation for “cross-posting”. https://wiki.postgresql.org/wiki/Mailing_Lists#Email_etiquette_mechanics On Thursday, May 21, 2020, postgann2020 s wrote: > > We have multiple long procs that are havin

Re: Suggestion to improve query performance of data validation in proc.

2020-05-22 Thread David G. Johnston
On Friday, May 22, 2020, postgann2020 s wrote: > > We are looking for a better query than "*SELECT 1 FROM schema.table_name > WHERE column1=structure_id1*" this query for data validation. > There is no more simple a query that involve records on a single,table. Please suggest is there any ot

Re: Query to get name a data type of a view

2020-05-22 Thread David G. Johnston
On Friday, May 22, 2020, stan wrote: > When I run the following query, > > > SELECT column_name,data_type > FROM information_schema.columns > WHERE table_name = 'mfg_part_view'; > > > I get the following result: > > column_name | data_type > --+--- > mfg

Re: How to get the OID of a view

2020-05-22 Thread David G. Johnston
On Fri, May 22, 2020 at 9:15 AM stan wrote: > I am trying to write a query to return the names, and data types of all the > columns in a view. It has been pointed out to me that the best approach > would be using pg_catalog. OK, so I found pg_view, which I can get the > names > of a the views fro

Re: query, probably needs window functions

2020-05-22 Thread David G. Johnston
On Friday, May 22, 2020, Scott Ribe wrote: > given, let's say: > > create table person (id int not null, name varchar); > create table phone (id int not null, person_id int not null, number > varchar); > > select person.*, phone.number from person join phone on (person.id = > phone.person_id) ord

Re: query, probably needs window functions

2020-05-22 Thread David G. Johnston
On Fri, May 22, 2020 at 12:38 PM Michael Lewis wrote: > I believe something like this is what you want. You might be able to do it > without a sub-query by comparing the current name value to the lag value > and null it out if it's the same. > This. I misread the question. You might also consi

Re: Query returns no rows in pg_basebackup cluster

2020-05-24 Thread David G. Johnston
On Sun, May 24, 2020 at 4:10 PM Michael Paquier wrote: > On Fri, May 22, 2020 at 09:53:37AM +0300, Andrus wrote: > > Backup in created in Windows from Linux server using pg_receivewal and > pg_basebackup . > > Can this backup used for PITR in Linux ? > > No. Physical copies need to be based on t

Re: Query returns no rows in pg_basebackup cluster

2020-05-24 Thread David G. Johnston
On Sunday, May 24, 2020, Andrus wrote: > Hi! > > Backup in created in Windows from Linux server using pg_receivewal and >>> pg_basebackup . >>> Can this backup used for PITR in Linux ? >>> >> No. Physical copies need to be based on the same platform. If you >> wish to replicate a cluster withou

Re: GPG signing

2020-05-26 Thread David G. Johnston
On Tuesday, May 26, 2020, Marc Munro wrote: > I need to be able to cryptographically sign objects in my database > using a public key scheme. > > Any other options? Am I missing something? > This feels like it should be an application (middleware...) concern, not the database proper. i.e., sto

Re: suggestion the process to sync the data from PROD DB to Staging environment

2020-05-27 Thread David G. Johnston
On Wed, May 27, 2020 at 8:56 AM postgann2020 s wrote: > Could someone please suggest the process to *sync the data from PROD DB > to the Staging environment* with minimal manual intervention or > automatically. > Read up on the general purpose "bash" scripting language, the PostgreSQL "pg_dump"

Re: suggestion the process to sync the data from PROD DB to Staging environment

2020-05-27 Thread David G. Johnston
On Wed, May 27, 2020 at 9:31 AM postgann2020 s wrote: > Thanks, David, > > Please find the environment details. > > Environment: > PROD: > OS: RHEL 7.1 > Postgres: 9.5.15 > > Staging: > OS: RHEL 7.1 > Postgres: 9.5.15 > Ok...not particularly helpful though I do see you are not keeping up with mi

Re: SELECT query results are different depending on whether table statistics are available.

2020-05-27 Thread David G. Johnston
On Wed, May 27, 2020 at 8:09 PM James Brauman wrote: > -- Run select query (involving several CTEs). > SELECT ...; > > I haven't generated a minimal test case yet, but I did notice that if > all CTEs in the SELECT query are defined using AS NOT MATERIALIZED the > results are always the same regar

Re: problem with self built postgres 9.0.9

2020-05-29 Thread David G. Johnston
On Fri, May 29, 2020 at 7:08 AM Gabriele Bulfon wrote: > Amazing! Rebuilt without -O and it worked like a charm! > Thanks, at the moment I need to stick to 9.0.9 on this machine to be able > to reuse the same database files. > > Just to be thorough. You can update to 9.0.23 (i.e., build against

Re: When to use PARTITION BY HASH?

2020-06-02 Thread David G. Johnston
On Tue, Jun 2, 2020 at 10:17 AM Oleksandr Shulgin < oleksandr.shul...@zalando.de> wrote: > That *might* turn out to be the case with a small number of distinct > values in the partitioning column(s), but then why rely on hash > assignment instead of using PARTITION BY LIST in the first place? > >

Re: A parsing question

2020-06-03 Thread David G. Johnston
On Wed, Jun 3, 2020 at 3:41 PM Michael Nolan wrote: > Recently I was typing in a query in PG 10.4. > > What I MEANT to type was: Where xyz >= 2400 > > What I actually typed was: Where xyz >- 2400 > > The latter was interpreted as 'where xyz > -2400', but I'm wondering if it > shouldn't have th

Re: Can we get SQL Server-like cross database queries

2020-06-04 Thread David G. Johnston
On Wednesday, June 3, 2020, Laurenz Albe wrote: > On Thu, 2020-06-04 at 16:41 +1200, Thomas Munro wrote: > > There's no doubt it's useful, and it's also part of the SQL spec, > > which says you can do catalog.schema.table. I would guess that we > > might get that as a byproduct of any project to

Re: gdal, proj and other postgis dependencies missing in postgres repos

2020-06-07 Thread David G. Johnston
On Sunday, June 7, 2020, Rene Romero Benavides wrote: > On Sun, Jun 7, 2020 at 5:37 PM Rene Romero Benavides < > rene.romer...@gmail.com> wrote: > >> Hi everybody, do you know what happened to gdal and other postgis >> dependencies like proj in the official postgres repos? >> they appear to be mi

Re: checking existence of a table before updating its SERIAL

2020-06-08 Thread David G. Johnston
On Monday, June 8, 2020, Matthias Apitz wrote: > > Can some kind soul help me with doing a test for the existence of the > table to avoid the error message about non existing relation? > https://www.postgresql.org/docs/12/catalogs-overview.html David J.

Re: Is it possible to use keywords (date units) in a function definition?

2020-06-08 Thread David G. Johnston
On Mon, Jun 8, 2020 at 2:57 PM Alistair Johnson wrote: > > RETURN EXTRACT(datepart FROM end - start); > Any ideas? Is this even possible? > Use the "date_part" function. David J.

Re: Is it possible to use keywords (date units) in a function definition?

2020-06-08 Thread David G. Johnston
On Mon, Jun 8, 2020 at 2:57 PM Alistair Johnson wrote: > Hello, > > I recently tried to write a wrapper function to calculate the difference > between two dates, mainly as a convenience. I'd essentially be emulating > EXTRACT( FROM date1 - date2), in various ways. I got a bit stuck > on allowing

Re: Is it possible to use keywords (date units) in a function definition?

2020-06-08 Thread David G. Johnston
On Mon, Jun 8, 2020 at 5:06 PM Martin Gainty wrote: > CREATE OR REPLACE FUNCTION DATETIME_DIFF(end TIMESTAMP(3), start > TIMESTAMP(3), datepart UNIT) RETURNS DOUBLE PRECISION AS $$ > Duplicate email from account (same sender) - already answered on the original/correct thread. David J.

Re: suggestion: psql configs in .config

2020-06-11 Thread David G. Johnston
On Thursday, June 11, 2020, Caleb Cushing wrote: > would it be possible to allow psql config files to reside in > ~/.config/psql to help unclutter ~ obviously this should be some kind of > cascading lookup > > first look for... e.g > .config/psql/psqlrc > .psqlrC > libpq consults environment var

Re: Returning SELECTed rows immediately instead of all at the end?

2020-06-12 Thread David G. Johnston
On Friday, June 12, 2020, Ron wrote: > > I'm running amcheck on a set of indices (test machine, not prod) and want > to track the progress. Is there a SELECT clause that makes rows display as > they are created, No > or do I have to explicitly call bt_index_check() from a shell script or > S

Re: pg_service.conf and client support

2020-06-13 Thread David G. Johnston
On Saturday, June 13, 2020, Niels Jespersen wrote: > Can anyone shed som light on the ubiquitousness of support for > pg_service.conf? > AFAIK same non-support for JDBC and Node.js > Are there any other mechanisms with broader support, that can be used > instead of pg_service.conf (if support is

Re: Unable to execute pg_dump

2020-06-14 Thread David G. Johnston
On Sunday, June 14, 2020, Joseph Maruca wrote: > > '''sudo -u postgres -H --psql -px -d db_name''' > > If I enter the following syntax from the RHEL command line: > > '''sudo su postgres''' > > I end up in the bash-4.1 shell. When executing the following command from > within the shell: bash-4

Re: create batch script to import into postgres tables

2020-06-19 Thread David G. Johnston
On Fri, Jun 19, 2020 at 6:58 AM Adrian Klaver wrote: > On 6/19/20 6:53 AM, Pepe TD Vo wrote: > > Thank you sir and I am sorry for the typo not having "--" on password. > > I did spelling out with --password=mypassword > > Please go back and read my post again. > To be clear, there is no way to s

Re: create batch script to import into postgres tables

2020-06-19 Thread David G. Johnston
On Fri, Jun 19, 2020 at 7:33 AM Adrian Klaver wrote: > On 6/19/20 7:17 AM, pepevo wrote: > > I understand your post about "password does not take an argument, it is > > meant to be used as is. The purpose is to force a password prompt." When > > I used -W and --password=. That's what I said I wi

Re: create batch script to import into postgres tables

2020-06-19 Thread David G. Johnston
On Friday, June 19, 2020, pepevo wrote: > We can't just install any softwares without Goverment's approval. Also, > they might ask Oracle/mysql/sql can run batch script, why not Postgres? I > wonder myself and just realize today from this email. > PostreSQL isn’t the issue here, you are. To t

Re: create batch script to import into postgres tables

2020-06-19 Thread David G. Johnston
On Friday, June 19, 2020, pepevo wrote: > But everything can run by script on the server, right? > Separation of concerns. The server with the database cluster should probably not be running application code. Application code can be run other machine, “admin” machine is one label. Though for

Re: Can the current session be notified and refreshed with a new credentials context?

2020-06-22 Thread David G. Johnston
On Mon, Jun 22, 2020 at 2:21 PM Ron wrote: > On 6/22/20 4:07 PM, AC Gomez wrote: > > Suppose you have the following scenario: > > 1: Call some function with a certain user and password > 2: From inside that function, have several calls using DBLink > 3: At some point during the running of that fu

Re: scram-sha-256 encrypted password in pgpass

2020-06-22 Thread David G. Johnston
Please don't cross-post. On Mon, Jun 22, 2020 at 1:35 PM Pavan Kumar wrote: > scram-sha-256 encrypted passwords are supported in .pgpass file ? If yes > kindly provide us an example. > > I am using below format and it is not working for me > > *pglnx1*:*5432*:pgbouncer:*pgadmin*:"SCRAM-SHA-256$4

Re: Feature suggestion: auto-prefixing SELECT query column names with table/alias names

2020-06-22 Thread David G. Johnston
On Sunday, June 21, 2020, Guy Burgess wrote: > > a.id, a.title, b.id, b.title You are missing some double-quotes there. Of course, this can be achieved by avoiding the (often frowned-upon) SELECT > * syntax in the first place and using explicit column names, Or choose better, distinguishi

Re: scram-sha-256 encrypted password in pgpass

2020-06-22 Thread David G. Johnston
On Mon, Jun 22, 2020 at 3:32 PM Pavan Kumar wrote: > Adrian, David, > > Thank you so much for the quick response. > > What would be the point of storing the encrypted password instead of the > plaintext one? > As per our organization security policies, we can 't keep any passwords > in plain tex

Re: Can the current session be notified and refreshed with a new credentials context?

2020-06-22 Thread David G. Johnston
On Mon, Jun 22, 2020 at 5:41 PM AC Gomez wrote: > But what I understand you to say is that, one can start running a function > in PG, change all security context from under it, and it will still work > under the original login context, despite the changes. > https://www.postgresql.org/docs/12/tu

Re: Persistent Connections

2020-06-23 Thread David G. Johnston
Why is there now a second thread for this topic? On Tue, Jun 23, 2020 at 3:21 PM Bee.Lists wrote: > > > > On Jun 23, 2020, at 4:51 PM, Michael Lewis wrote: > > > > Do you see anything in pg_stat_activity that stays idle for a while and > then *does* disappear on its own? Perhaps some types of c

Re: Need help with PITR for PostgreSQL 9.4.5

2020-06-24 Thread David G. Johnston
The version you are running is neither up-to-date for its major version (9.4) nor is the major version being supported. https://www.postgresql.org/support/versioning/ Thoug a functioning backup is good to have before upgrading, especially major versions. On Wednesday, June 24, 2020, Sri Linux w

Re: EXTERNAL: Re: Netapp SnapCenter

2020-06-25 Thread David G. Johnston
On Thu, Jun 25, 2020 at 8:24 AM Paul Förster wrote: > Archived WAL is another thing, but PGDATA and pg_wal should IMHO always be > located on the same volume, along with tablespaces, if any. > My understanding that having such a setup (single volume) eases administration at the cost of performan

Re: libpq pipelineing

2020-06-26 Thread David G. Johnston
On Friday, June 26, 2020, Samuel Williams wrote: > Hello, > > Using the asynchronous interface of libpq, is it possible to pipeline > multiple queries? > > i.e. > > PQsendQuery(query1) > PQsendQuery(query2) > > followed by > > query1_results = PQgetResult(...) > query2_results = PQgetResult(...)

Re: libpq pipelineing

2020-06-26 Thread David G. Johnston
On Friday, June 26, 2020, Samuel Williams wrote: > Thanks David, > > You are correct. > > I was giving an example of what I was hoping to achieve, not what I > expected to work with the current interface. > What about, as it says, sending multiple statements in a single sendQuery and then pollin

Re: libpq pipelineing

2020-06-26 Thread David G. Johnston
On Friday, June 26, 2020, Samuel Williams wrote: > > What about, as it says, sending multiple statements in a single > sendQuery and then polling for multiple results? > > I tried this, and even in single row streaming mode, I found that > there are cases where the results would not be streamed u

Re: Can't seem to mix an inner and outer join in a query and get it to work right.

2020-06-29 Thread David G. Johnston
On Monday, June 29, 2020, David Gauthier wrote: > >sqf_id | sqf_sl | as_cl | > wa_id | type > > +--- > --+-+---+--- > > * arazhang_20.06.28-20:59:06_soc_navi24_main@44047

Re: Can't seem to mix an inner and outer join in a query and get it to work right.

2020-07-01 Thread David G. Johnston
The convention here is to bottom post or inline responses. On Wed, Jul 1, 2020 at 9:51 AM David Gauthier wrote: > Actually, I want the outer join first. If it finds something, then move > on to the inner join and filter out all those that don't join to a rec with > 'autosmoke'. But if the oute

<    1   2   3   4   5   6   7   8   9   10   >