Re: Converting yes or no to one letter strings.

2019-06-04 Thread Ron
On 6/4/19 7:19 PM, Adrian Klaver wrote: On 6/4/19 3:29 PM, Lou wrote: Hi everyone, Is it possible to convert a boolean yes or no field to hold a one letter string? For example, the strings: 's' 'f' 'p' 'e' To start off, I just need to convert true to 's'. false will have to be manually

Re: Query very different speeds on seemingly similar data

2019-06-04 Thread David Rowley
On Wed, 5 Jun 2019 at 04:55, Rob Northcott wrote: > Explain files attached (assuming attachments will get through to the group – > otherwise what’s the best way to post it?) You're best to post the EXPLAIN ANALYZE output to https://explain.depesz.com what you attached is pretty horrible to

Re: Converting yes or no to one letter strings.

2019-06-04 Thread Adrian Klaver
On 6/4/19 3:29 PM, Lou wrote: Hi everyone, Is it possible to convert a boolean yes or no field to hold a one letter string? For example, the strings: 's' 'f' 'p' 'e' To start off, I just need to convert true to 's'. false will have to be manually changed to 'f' or 'p' or 'e' as appropriate.

Re: Converting yes or no to one letter strings.

2019-06-04 Thread Rich Shepard
On Tue, 4 Jun 2019, David G. Johnston wrote: Actually, given that "f" is becoming multiple different values it seems like the OP is improving upon their data model. That should very much be done at the table level at not relegated to views, let alone a UI layer. It is not unusual to want to

Re: Converting yes or no to one letter strings.

2019-06-04 Thread David G. Johnston
On Tue, Jun 4, 2019 at 4:01 PM Rich Shepard wrote: > On Tue, 4 Jun 2019, Lou wrote: > > > To start off, I just need to convert true to 's'. false will have to be > > manually changed to 'f' or 'p' or 'e' as appropriate. > > Second, if you need to display to the user something other than 't' and

Re: Converting yes or no to one letter strings.

2019-06-04 Thread David G. Johnston
On Tue, Jun 4, 2019 at 3:30 PM Lou wrote: > Is it possible to convert a boolean yes or no field to hold a one letter > string? For example, the strings: 's' 'f' 'p' 'e' > Something like the following should work: ALTER TABLE ... ALTER COLUMN ... TYPE text USING (CASE WHEN ... THEN 's' ELSE 'f'

Re: Converting yes or no to one letter strings.

2019-06-04 Thread Ray O'Donnell
On 4 June 2019 23:30:33 Lou wrote: Hi everyone, Is it possible to convert a boolean yes or no field to hold a one letter string? For example, the strings: 's' 'f' 'p' 'e' To start off, I just need to convert true to 's'. false will have to be manually changed to 'f' or 'p' or 'e' as

Re: Converting yes or no to one letter strings.

2019-06-04 Thread Rich Shepard
On Tue, 4 Jun 2019, Lou wrote: To start off, I just need to convert true to 's'. false will have to be manually changed to 'f' or 'p' or 'e' as appropriate. Lou, I'm far from an expert so take my comments with a bag of salt. First, 'false' is displayed in a column as 'f' when you look at a

Converting yes or no to one letter strings.

2019-06-04 Thread Lou
Hi everyone, Is it possible to convert a boolean yes or no field to hold a one letter string? For example, the strings: 's' 'f' 'p' 'e' To start off, I just need to convert true to 's'. false will have to be manually changed to 'f' or 'p' or 'e' as appropriate. Lou

postgresql11-devel RPM is missing from "Direct RPM downloads"

2019-06-04 Thread Dmitry O Litvintsev
Hi, Where can I find postgresq11-devel RPM ? It is missing from direct RPM download page : https://yum.postgresql.org/11/redhat/rhel-7-x86_64/repoview/ or https://yum.postgresql.org/11/redhat/rhel-7-x86_64/repoview/postgresqldbserver11.group.html Thanks, Dmitry

Re: dump and restore ordered by schema or table name

2019-06-04 Thread Fabrízio de Royes Mello
Em ter, 4 de jun de 2019 às 17:16, PegoraroF10 escreveu: > Our database has 180 schemas with 100 tables each, with majority of them > being small tables. Then, when we do a dump or restore we don´t know how > much time it´ll spend to do that job. > > So, there is an option to dump or restore

dump and restore ordered by schema or table name

2019-06-04 Thread PegoraroF10
Our database has 180 schemas with 100 tables each, with majority of them being small tables. Then, when we do a dump or restore we don´t know how much time it´ll spend to do that job. So, there is an option to dump or restore ordered alphabetically ? It could be by schema or table, do we have it

Re: Two small questions re/ COPY CSV data into table

2019-06-04 Thread Francisco Olarte
Mathias: On Tue, Jun 4, 2019 at 8:35 PM Matthias Apitz wrote: > El día Tuesday, June 04, 2019 a las 05:41:43PM +0200, Francisco Olarte > escribió: > > On Tue, Jun 4, 2019 at 5:03 PM Matthias Apitz wrote: > > > Well, it's not strictly CSV, but it is what the Sybase tool produces. The > > >

Re: Two small questions re/ COPY CSV data into table

2019-06-04 Thread Andrew Gierth
> "Matthias" == Matthias Apitz writes: Matthias> it is exported into the file as Matthias> cmd \| lpr ... Matthias> because the export delimiter is set to '|'; Matthias> the COPY in text mode was complaining because it interpreted Matthias> the | of the sequence \| as an

Re: Two small questions re/ COPY CSV data into table

2019-06-04 Thread Matthias Apitz
El día Tuesday, June 04, 2019 a las 05:56:49PM +0100, Andrew Gierth escribió: > Matthias> The new DELIMITER for PG is then vtab and the | is just a char in > the > Matthias> data (in the example above a pipe of two UNIX cmd). > > Yes, but why? > > If you use COPY ... WITH DELIMITER '|' (i.e.

Re: psql \copy

2019-06-04 Thread paul.malm
Thanx, it worked! :) 4 juni 2019 kl. 11:00 skrev Pavel Stehule mailto:pavel.steh...@gmail.com>>: Hi út 4. 6. 2019 v 10:50 odesílatel mailto:paul.m...@lfv.se>> napsal: Hi. I’m trying to execute this command: C:\P_bin\psql -h 10.233.37.24 -p 5432 -U tester -d test -w -c "\copy

Re: Two small questions re/ COPY CSV data into table

2019-06-04 Thread Andrew Gierth
> "Matthias" == Matthias Apitz writes: Matthias> sed 's/|/\v/g' < table-from-Sybase | sed 's/\\\v/|/g' > table-for-copy >> What on earth is this supposed to achieve? Matthias> It first translates any char '|' to vtab and then any '\vtab' Matthias> (i.e. a backslash followed by a

Query very different speeds on seemingly similar data

2019-06-04 Thread Rob Northcott
I've got a weird problem that I can't work out... A customer was complaining that their system was running slowly. They've only been using it for a few days, so we tested it on our copy of their data and it's running at normal speed. Uploaded our backup to the live server and it's still quick.

Re: One way replication in PostgreSQL

2019-06-04 Thread Frank Alberto Rodriguez
The FDW is a PostgreSQL extension to connect to other server from PosgreSQL server inside, with this solution you only need connections from P to S and no need a third server (external server), just use triggers to push the INSERT/UPDATE/DELETE information you want to replicate from P to S

Re: Two small questions re/ COPY CSV data into table

2019-06-04 Thread Matthias Apitz
El día Tuesday, June 04, 2019 a las 04:41:47PM +0100, Andrew Gierth escribió: > Matthias> I do load this now with COPY in mode TEXT and modify the data > Matthias> before with: > > Matthias> sed 's/|/\v/g' < table-from-Sybase | sed 's/\\\v/|/g' > > table-for-copy > > What on earth is this

Re: Long running query - connection and keepalives enabled but query not canceled

2019-06-04 Thread Laurenz Albe
Tomasz Ostrowski wrote: > I have database users which have to run some ad-hoc queries on the > database. These queries sometimes are pretty long running, especially > when a user messes up a join condition for two 1Grows tables and > therefore tries to count the number of quarks in the universe

Long running query - connection and keepalives enabled but query not canceled

2019-06-04 Thread Tomasz Ostrowski
Hi. I have database users which have to run some ad-hoc queries on the database. These queries sometimes are pretty long running, especially when a user messes up a join condition for two 1Grows tables and therefore tries to count the number of quarks in the universe or something like this.

Re: Two small questions re/ COPY CSV data into table

2019-06-04 Thread Andrew Gierth
> "Matthias" == Matthias Apitz writes: >> That sounds like the file is not actually a CSV - why do you think >> it is? Matthias> Well, it's not strictly CSV, In other words it's not a CSV at all. Matthias> I do load this now with COPY in mode TEXT and modify the data Matthias> before

Re: Two small questions re/ COPY CSV data into table

2019-06-04 Thread Matthias Apitz
El día Tuesday, June 04, 2019 a las 11:32:45AM +0100, Andrew Gierth escribió: > Matthias> 2. The CSV export is done by some Sybase tool which escapes > Matthias> the delimiter as '\|', i.e. putting a backslash before the > Matthias> delimiter. I found no way that COPY understands this >

Re: Questions about btree_gin vs btree_gist for low cardinality columns

2019-06-04 Thread Jeremy Finzel
On Sun, Jun 2, 2019 at 6:07 PM Tom Lane wrote: > Anyway, the larger point here is that right now btree_gin is just a quick > hack, and it seems like it might be worth putting some more effort into > it, because the addition of duplicate-compression changes the calculus > for whether it's useful.

Re: Research on ?? operators

2019-06-04 Thread Steve Atkins
> On Jun 4, 2019, at 1:35 PM, Michael Lewis wrote: > > ":foo" named placeholders > > If I may, is this supported natively in Postgres prepared statements? It's not. The only type we support are numbered $1 type placeholders. > Can I see an example? I do not care much for the numbers of

Re: Research on ?? operators

2019-06-04 Thread Matteo Beccati
Hi Michael, On 04/06/2019 14:35, Michael Lewis wrote: > /":foo" named placeholders/ > > If I may, is this supported natively in Postgres prepared statements? > Can I see an example? I do not care much for the numbers of positional > placeholders and would love to use names instead if possible.

Re: Research on ?? operators

2019-06-04 Thread Michael Lewis
*":foo" named placeholders* If I may, is this supported natively in Postgres prepared statements? Can I see an example? I do not care much for the numbers of positional placeholders and would love to use names instead if possible.

Re: Research on ?? operators

2019-06-04 Thread Matteo Beccati
Hi Steve, On 04/06/2019 12:49, Steve Atkins wrote: > Doubling "?" to "??" isn't an obvious, intuitive way to do that, at least > to me. Maybe it would be to people coming from Java. Funny enough, when I proposed \? on the pg mailing lists a few years ago I was suggested ?? to match SQL escaping

Re: Research on ?? operators

2019-06-04 Thread Matteo Beccati
Hi Andrew, On 04/06/2019 12:38, Andrew Gierth wrote: >> "Matteo" == Matteo Beccati writes: > > Matteo> https://wiki.php.net/rfc/pdo_escape_placeholders > > Matteo> One question that I'm supposed to answer now is: is there any > Matteo> known usage in the wild of some custom "??"

Re: Research on ?? operators

2019-06-04 Thread Steve Atkins
> On Jun 4, 2019, at 10:00 AM, Matteo Beccati wrote: > > Hello generals, > > I'm trying to resurrect a change to the PHP PDO driver to allow using > the "?" json operator (and other operators containing a question mark), > without it being interpreted as a placeholder for a query argument.

Re: Research on ?? operators

2019-06-04 Thread Andrew Gierth
> "Matteo" == Matteo Beccati writes: Matteo> https://wiki.php.net/rfc/pdo_escape_placeholders Matteo> One question that I'm supposed to answer now is: is there any Matteo> known usage in the wild of some custom "??" operator that would Matteo> require funny escaping like ""? I

Re: Two small questions re/ COPY CSV data into table

2019-06-04 Thread Andrew Gierth
> "Matthias" == Matthias Apitz writes: Matthias>... WITH DELIMITER '|', FORMAT CSV ; I think you misread the docs; the new-style syntax would be COPY ... WITH (DELIMITER '|', FORMAT CSV); where the parens are not optional. The old-style syntax with no parens after WITH is what you

Two small questions re/ COPY CSV data into table

2019-06-04 Thread Matthias Apitz
Hello, I'm using COPY to load CSV data into the table in PG 10.x and have to simple questions: 1. I do use as command: COPY adm_cat FROM '/home/sisis/PostgreSQL/PDcsv/adm_cat.load' WITH DELIMITER '|' CSV ; which works fine. When I read the PG docs the syntax should be ... WITH

Re: psql \copy

2019-06-04 Thread Pavel Stehule
Hi út 4. 6. 2019 v 10:50 odesílatel napsal: > Hi. I’m trying to execute this command: > > C:\P_bin\psql -h 10.233.37.24 -p 5432 -U tester -d test -w -c "\copy > public.BadenWuerttemberg_20181011 FROM C:\data\Baden-Wuerttemberg.csv' WITH > DELIMITER ';' CSV" > > Error: relation

Research on ?? operators

2019-06-04 Thread Matteo Beccati
Hello generals, I'm trying to resurrect a change to the PHP PDO driver to allow using the "?" json operator (and other operators containing a question mark), without it being interpreted as a placeholder for a query argument. In order to do so, like Hibernate, I went for the double "??" escaping:

psql \copy

2019-06-04 Thread paul.malm
Hi. I'm trying to execute this command: C:\P_bin\psql -h 10.233.37.24 -p 5432 -U tester -d test -w -c "\copy public.BadenWuerttemberg_20181011 FROM C:\data\Baden-Wuerttemberg.csv' WITH DELIMITER ';' CSV" Error: relation "public.badenwuerttemberg_20181011" does not exist. What am I Doing wrong?

Re: One way replication in PostgreSQL

2019-06-04 Thread Achilleas Mantzios
On 4/6/19 10:02 π.μ., PALAYRET Jacques wrote: Hello, Thanks a lot for the suggested solutions. So, I can use WAL-shipping replication from Primary to the Secundary server, but it's only for full replication. Let's call " P " the provider/primary/master  and " S " the

Re: One way replication in PostgreSQL

2019-06-04 Thread Guillaume Lelarge
Le mar. 4 juin 2019 à 09:03, PALAYRET Jacques a écrit : > Hello, > > Thanks a lot for the suggested solutions. > > So, I can use WAL-shipping replication from Primary to the Secundary > server, but it's only for full replication. > > Yes. Let's call " P " the provider/primary/master and " S "

Re: One way replication in PostgreSQL

2019-06-04 Thread PALAYRET Jacques
Hello, Thanks a lot for the suggested solutions. So, I can use WAL-shipping replication from Primary to the Secundary server, but it's only for full replication. Let's call " P " the provider/primary/master and " S " the subscriber/secundary/slave one. For partial replication (not all the

Re: csvlog Behavior when log file missing

2019-06-04 Thread Laurenz Albe
Lesley Kimmel wrote: > I have a system where postgres seems to be randomly dying. When researching > the issue > I, of course, began looking at logs. > > I found that much of the logs were missing due to logrotate configuration on > the server. > Logs were being rotated by size and then