CREATE COLLATION to match pg_collation data

2019-01-11 Thread rihad
Hi, since pg_import_system_collations() that would solve all this doesn't exist in 9.6.x, is there a way to I properly map it to a CREATE COLLATE call? Specifically I need to have this collation (from 10.x) in 9.6.x so it works on FreeBSD:     collname    | collnamespace | collowner |

Re: insert into: NULL in date column

2019-01-11 Thread Ricardo Martin Gomez
Hi, one question. Do you put explicit "NULL" in the column value? Other option is. You have to delete the column "next_contact" in your INSERT clause. So, if the column has a default value, this value Will be inserted. Else Null value will be inserted. Regards Obtener Outlook para Android

Re: insert into: NULL in date column

2019-01-11 Thread Adrian Klaver
On 1/11/19 4:00 PM, Rich Shepard wrote: On Fri, 11 Jan 2019, Ken Tanzer wrote: I think the problem is actually that you're trying to represent your NULL dates with '', which PG doesn't like. Ken,   That's certainly how I saw the error message. cat test.csv my_text,my_date,my_int 'Some Te

Re: insert into: NULL in date column

2019-01-11 Thread David G. Johnston
On Fri, Jan 11, 2019 at 4:25 PM Rob Sargent wrote: > We don't have more context in "activities.sql" but if your OP was > verbatim, it's keeling over on the comma ending the long text string. > Something syntactically askew I think. If the problem was where you described the parser would never hav

Re: insert into: NULL in date column

2019-01-11 Thread David G. Johnston
On Fri, Jan 11, 2019 at 3:56 PM Rich Shepard wrote: > > A table has this column definition: > > next_contact date DEFAULT '2020-11-06' > CONSTRAINT valid_next_date > CHECK (next_contact >= CURRENT_DATE), > > (and I don't know that it needs a default). The default d

Re: insert into: NULL in date column

2019-01-11 Thread David G. Johnston
On Fri, Jan 11, 2019 at 5:01 PM Rich Shepard wrote: > On Fri, 11 Jan 2019, Ken Tanzer wrote: > > \copy my_test FROM test.csv WITH CSV HEADER > > > > ERROR: invalid input syntax for type date: "''" > > CONTEXT: COPY my_test, line 4, column my_date: "''" Right problem wrong solution since it appe

Re: insert into: NULL in date column

2019-01-11 Thread Rich Shepard
On Fri, 11 Jan 2019, Ken Tanzer wrote: I think the problem is actually that you're trying to represent your NULL dates with '', which PG doesn't like. Ken, That's certainly how I saw the error message. cat test.csv my_text,my_date,my_int 'Some Text','1/1/18',3 'More Text,,2 'Enough','',1

Re: insert into: NULL in date column

2019-01-11 Thread Rich Shepard
On Fri, 11 Jan 2019, Rob Sargent wrote: Something syntactically askew I think. Rob, I agree that's the problem. Why there's a problem is what I need to learn. Thanks, Rich

Re: insert into: NULL in date column

2019-01-11 Thread Ken Tanzer
On Fri, Jan 11, 2019 at 3:25 PM Rob Sargent wrote: > > On 1/11/19 4:21 PM, Rich Shepard wrote: > > On Fri, 11 Jan 2019, Rob Sargent wrote: > > > >>> psql:activities.sql:2: ERROR: invalid input syntax for type date: "" > >>> LINE 2: ...reaction they''ve experienced environmental issues.','','');

Re: insert into: NULL in date column

2019-01-11 Thread Rob Sargent
On 1/11/19 4:21 PM, Rich Shepard wrote: On Fri, 11 Jan 2019, Rob Sargent wrote: psql:activities.sql:2: ERROR:  invalid input syntax for type date: "" LINE 2: ...reaction they''ve experienced environmental issues.','',''); ^ Mi

Re: insert into: NULL in date column

2019-01-11 Thread Rich Shepard
On Fri, 11 Jan 2019, Rob Sargent wrote: psql:activities.sql:2: ERROR:  invalid input syntax for type date: "" LINE 2: ...reaction they''ve experienced environmental issues.','','');     ^ Miss-matched single quotes in activities.sql?

Re: insert into: NULL in date column

2019-01-11 Thread Rob Sargent
On 1/11/19 3:56 PM, Rich Shepard wrote: A table has this column definition: next_contact date DEFAULT '2020-11-06'    CONSTRAINT valid_next_date    CHECK (next_contact >= CURRENT_DATE), (and I don't know that it needs a default). In an input statement that column is l

insert into: NULL in date column

2019-01-11 Thread Rich Shepard
A table has this column definition: next_contact date DEFAULT '2020-11-06' CONSTRAINT valid_next_date CHECK (next_contact >= CURRENT_DATE), (and I don't know that it needs a default). In an input statement that column is left empty ('') when there's no defined date

Re: Benchmark of using JSON to transport query results in node.js

2019-01-11 Thread Michel Pelletier
On Fri, Jan 11, 2019 at 10:31 AM Mitar wrote: > Hi! > > > Another option is to query directly from node.js and get JSON or native > query from the database (extensive use of functions / stored procedures). > > For web applications, I was even thinking about this crazy approach: > get PostgreSQL t

Re: Benchmark of using JSON to transport query results in node.js

2019-01-11 Thread Mitar
Hi! On Fri, Jan 11, 2019 at 3:06 AM Tony Shelver wrote: > I'm fairly new to Postgres, but one question is how node.js implements the > native driver when fetching the data: fetchall, fetchmany or fetch.single? > Also which native driver is it using? The package I used is here [1]. It is using

Re: How to always run UPDATE FROM despite missing records in the source table?

2019-01-11 Thread Andrew Gierth
> "Alexander" == Alexander Farber writes: Alexander> However the following query does not work as intended and Alexander> does not update any fields, because there is no matching Alexander> block in the geoip table found: Alexander> UPDATE users u SET Alexander> visited = now(),

Re: How to always run UPDATE FROM despite missing records in the source table?

2019-01-11 Thread Adrian Klaver
On 1/11/19 4:50 AM, Alexander Farber wrote: Good afternoon I have prepared a simplified test case for my question: https://www.db-fiddle.com/f/22jfWnsvqD8hVeFPXsyLbV/0 In PostgreSQL 10.6 there are 2 tables: CREATE TABLE users (     uid SERIAL PRIMARY KEY,         created       timestam

RE: How to always run UPDATE FROM despite missing records in the source table?

2019-01-11 Thread Kevin Brannen
From: Alexander Farber * The only workaround that I could think of is - UPDATE users SET visited = now(), ip = '20.20.20.20'::inet, lat = (SELECT lat FROM geoip WHERE '20.20.20.20'::inet <<= block), lng = (SELECT lng FROM geoip WHERE '20.20.20.20'::inet <<= bloc

Re: log level of "drop cascade" lists

2019-01-11 Thread Willy-Bas Loos
On Thu, Jan 10, 2019 at 4:44 PM Adrian Klaver wrote: > > 1) BEGIN; > DROP schema myschema CASCADE; > ROLLBACK/COMMIT; > > 2) \d myschema.* On Thu, Jan 10, 2019 at 5:04 PM Tom Lane wrote: > I think that would be met with more complaints than kudos. > "WARNING" is supposed to mean "there's prob

How to always run UPDATE FROM despite missing records in the source table?

2019-01-11 Thread Alexander Farber
Good afternoon I have prepared a simplified test case for my question: https://www.db-fiddle.com/f/22jfWnsvqD8hVeFPXsyLbV/0 In PostgreSQL 10.6 there are 2 tables: CREATE TABLE users ( uid SERIAL PRIMARY KEY, created timestamptz NOT NULL, visited timestamptz NO

Re: Benchmark of using JSON to transport query results in node.js

2019-01-11 Thread Tony Shelver
I'm fairly new to Postgres, but one question is how node.js implements the native driver when fetching the data: fetchall, fetchmany or fetch.single? Also which native driver is it using? Does the native driver do a round trip for each record fetched, or can it batch them into multiples? For examp