[GENERAL] inevitability of to_date() when converting representations which don't represent whole timestamps

2017-03-29 Thread Shaun Cutts
When being asked to convert a day of the week, the to_date() function returns the same day ('0001-01-01 BC’) no matter which day is converted: # select to_date(‘Monday’, ‘Day’) '0001-01-01 BC’ # select to_date(‘Tuesday’, ‘Day’) '0001-01-01 BC’ However, if it were to return a date that was that

Re: [GENERAL] Tablespace Default Behavior

2017-03-29 Thread harpagornis
That is what I suspected, and thank you for the explanation. I think it is misleading and a bug in PgAdmin for explicitly listing the tablespace as pg_default. -- View this message in context: http://www.postgresql-archive.org/Tablespace-Default-Behavior-tp5952910p5952929.html Sent from the Po

Re: [GENERAL] Tablespace Default Behavior

2017-03-29 Thread Tom Lane
harpagornis writes: > When I create a table, like this: > CREATE TABLE myschema.mytable (rc_id integer NOT NULL) TABLESPACE > my_space; > and then I do: > select * from pg_tables where schemaname ='myschema'; > the tablespace is blank for the new table. When I look in PgAdmin, the > tabl

Re: [GENERAL] Tablespace Default Behavior

2017-03-29 Thread harpagornis
More Info Edit: Also, the database is in the my_space tablespace. The location for the my_space tablespace is a different folder than the $PGDATA folder. -- View this message in context: http://www.postgresql-archive.org/Tablespace-Default-Behavior-tp5952910p5952917.html Sent from the Post

[GENERAL] Tablespace Default Behavior

2017-03-29 Thread harpagornis
I am somewhat new to Postgresql. I cant seem to create a table in a non-default tablespace. In the postgresql.conf file, I have: default_tablespace = ''". When I create a table, like this: CREATE TABLE myschema.mytable (rc_id integer NOT NULL) TABLESPACE my_space; and then I do: se

Re: [GENERAL] Vacuuming tables with BRIN index and CLUSTER ON index

2017-03-29 Thread Cherio
On Wed, Mar 29, 2017 at 4:58 PM, David G. Johnston < david.g.johns...@gmail.com> wrote: > On Wed, Mar 29, 2017 at 1:34 PM, Cherio wrote: > >> I have an insert/select only table (no update/delete expected) and a BRIN >> index on the timestamp column as follows >> >> CREATE TABLE log_table ( >> i

Re: [GENERAL] Vacuuming tables with BRIN index and CLUSTER ON index

2017-03-29 Thread David G. Johnston
On Wed, Mar 29, 2017 at 1:34 PM, Cherio wrote: > I have an insert/select only table (no update/delete expected) and a BRIN > index on the timestamp column as follows > > CREATE TABLE log_table ( > id BIGSERIAL NOT NULL, > data TEXT, > created_at TIMESTAMP WITHOUT TIME ZONE DEFAULT now() >

Re: [GENERAL] Handling psql lost connections

2017-03-29 Thread JP Jacoupy
Not a response to OP but this also occurs with libpq connections. The only thing I found at the moment is to lower the net.ipv4.tcp_retries2 value to 8 (instead of 15). This will lower the TCP timeout from kernel to around 100 seconds instead of 15 minutes. Sent from ProtonMail mobile ---

[GENERAL] Vacuuming tables with BRIN index and CLUSTER ON index

2017-03-29 Thread Cherio
I have an insert/select only table (no update/delete expected) and a BRIN index on the timestamp column as follows CREATE TABLE log_table ( id BIGSERIAL NOT NULL, data TEXT, created_at TIMESTAMP WITHOUT TIME ZONE DEFAULT now() CONSTRAINT log_table__pk PRIMARY KEY(id) ); CREATE INDEX log_t

Re: [GENERAL] Constraint exclusion-like behavior for UNION ALL views

2017-03-29 Thread Tony Cebzanov
On 3/29/17 3:39 PM, David G. Johnston wrote: That said, I'm not sure what using materialized views instead of normal tables buys you in the first place. I could see possibly using a materialized view as the current month's table but the historical tables usually don't require refreshing. My e

Re: [GENERAL] Constraint exclusion-like behavior for UNION ALL views

2017-03-29 Thread David G. Johnston
On Wed, Mar 29, 2017 at 12:19 PM, Tony Cebzanov wrote: > Are either of these things that could be supported in the future? If not, > is there a better way to get this kind of behavior so that materialized > views are more useful when the amount of data increases and it's not > feasible to update

Re: [GENERAL] Handling psql lost connections

2017-03-29 Thread Adrian Klaver
On 03/29/2017 11:48 AM, Steve Crawford wrote: On Wed, Mar 29, 2017 at 9:05 AM, Adrian Klaver mailto:adrian.kla...@aklaver.com>> wrote: On 03/29/2017 08:49 AM, Steve Crawford wrote: When firewalls/VPNs stand between my psql client and a remote PostgreSQL server the co

[GENERAL] Constraint exclusion-like behavior for UNION ALL views

2017-03-29 Thread Tony Cebzanov
PostgreSQL's materialized view functionality is very useful, but one problem is that when the view gets large, there is no way to refresh part of it. I know that table partitioning is coming in Postgres 10, but I haven't heard anything about ideas for partitioning / sharding of materialized vi

Re: [GENERAL] Handling psql lost connections

2017-03-29 Thread Steve Crawford
On Wed, Mar 29, 2017 at 9:05 AM, Adrian Klaver wrote: > On 03/29/2017 08:49 AM, Steve Crawford wrote: > >> When firewalls/VPNs stand between my psql client and a remote PostgreSQL >> server the connection will on occasion time out and drop. This results >> in the following scenario: >> >> -Leave

Re: [GENERAL] Handling psql lost connections

2017-03-29 Thread Adrian Klaver
On 03/29/2017 08:49 AM, Steve Crawford wrote: When firewalls/VPNs stand between my psql client and a remote PostgreSQL server the connection will on occasion time out and drop. This results in the following scenario: -Leave for lunch mid project - leave psql open. -Return from lunch, complete a

[GENERAL] Handling psql lost connections

2017-03-29 Thread Steve Crawford
When firewalls/VPNs stand between my psql client and a remote PostgreSQL server the connection will on occasion time out and drop. This results in the following scenario: -Leave for lunch mid project - leave psql open. -Return from lunch, complete and submit large query. -Notice query is taking

Re: [GENERAL] Postgres Permissions Article

2017-03-29 Thread Paul Jungwirth
On 03/29/2017 06:36 AM, Tom Lane wrote: Karsten Hilbert writes: Being able to create foreign keys may allow to indirectly discover whether certain values exists in a table which I don't otherwise have access to (by means of failure or success to create a judiciously crafted FK). Aside from th

[GENERAL] Logical Replication: adjacent COMMIT messages with the wrong StartLSN

2017-03-29 Thread Stefan Smith
Hi, I have been evaluating the logical replication feature in v42.0.0 against postgres v9.6. One scenario I'm testing is streaming a high volume of transactions, where each transaction contains multiple INSERTs. Sometimes, two transaction COMMITS are side by side in the DB transaction log, and so

Re: [GENERAL] Request to add feature to the Position function

2017-03-29 Thread Adrian Klaver
On 03/29/2017 04:06 AM, Ron Ben wrote: I never expected it to be implemented now.. I understand that there are policies and priorities I tried to find a feature request chanle but there is none... This list and and/or --hackers would be that channel. I don't know how the postresql team deci

Re: [GENERAL] Using relations in the SELECT part

2017-03-29 Thread Tom Lane
Giuseppe Sacco writes: > the solution I found is: > postgres=# select key, > unnest(regexp_split_to_array(plates, E'\\s+')) AS plate from t; > 1. why may I put in the SELECT part (instead of the FROM) a relation? > When I studied SQL, I was told to put all relations in FROM, and put in > the SEL

Re: [GENERAL] Postgres Permissions Article

2017-03-29 Thread Tom Lane
Karsten Hilbert writes: > On Tue, Mar 28, 2017 at 09:47:40AM -0700, Paul Jungwirth wrote: >> I wrote a blog post about the Postgres permissions system, and I thought I'd >> share: >> http://illuminatedcomputing.com/posts/2017/03/postgres-permissions/ > Not that I am an expert in any way but here'

Re: [GENERAL] How to get correct local time

2017-03-29 Thread Adrian Klaver
On 03/29/2017 03:03 AM, Andrus wrote: select current_time at time zone 'GMT-2' returns "11:54:40.22045+02" but correct local time in Windows is one hour different: 12:54 How to get correct local time ? What time zone are you in? What is the TimeZone set to in postgresql.conf? Usi

Re: [GENERAL] How to get correct local time

2017-03-29 Thread Vitaly Burovoy
On 3/29/17, Vitaly Burovoy wrote: > On 3/29/17, Andrus wrote: >> >> select current_time at time zone 'GMT-2' >> >> returns >> >> "11:54:40.22045+02" >> >> but correct local time in Windows is one hour different: >> >> 12:54 >> >> How to get correct local time ? >> >> >> Using >> >> "PostgreSQ

Re: [GENERAL] Request to add feature to the Position function

2017-03-29 Thread Ron Ben
I never expected it to be implemented now.. I understand that there are policies and priorities I tried to find a feature request chanle but there is none... I don't know how the postresql team decied what is on the "to do list" and what is not. This is a feature which I think people will find usef

Re: [GENERAL] How to get correct local time

2017-03-29 Thread Vitaly Burovoy
On 3/29/17, Andrus wrote: > > select current_time at time zone 'GMT-2' > > returns > > "11:54:40.22045+02" > > but correct local time in Windows is one hour different: > > 12:54 > > How to get correct local time ? > > > Using > > "PostgreSQL 9.6.0, compiled by Visual C++ build 1800, 32-bit" >

[GENERAL] How to get correct local time

2017-03-29 Thread Andrus
select current_time at time zone 'GMT-2' returns "11:54:40.22045+02" but correct local time in Windows is one hour different: 12:54 How to get correct local time ? Using "PostgreSQL 9.6.0, compiled by Visual C++ build 1800, 32-bit" with standard postgresql.conf file in Windows 10 Sam

Re: [GENERAL] Postgres Permissions Article

2017-03-29 Thread Karsten Hilbert
On Tue, Mar 28, 2017 at 09:47:40AM -0700, Paul Jungwirth wrote: > I wrote a blog post about the Postgres permissions system, and I thought I'd > share: > > http://illuminatedcomputing.com/posts/2017/03/postgres-permissions/ > I also shared a few opinions amidst the facts (like that `USAGE` for s

[GENERAL] Using relations in the SELECT part

2017-03-29 Thread Giuseppe Sacco
Hello, I am writing to this list since I wrote a query that I cannot really understand. So, thanks to anyone who will light my darkness :-) I have a table with two columns, the first one is a key, the second one is a list of car plates. What I need to extract is a result set that contains two colu