Re: [GENERAL] Timezone difference between Oracle SYSDATE and PostgreSQL timestamp functions

2014-08-29 Thread Albe Laurenz
Vinayak wrote: We have converted Oracle SYSDATE to PostgreSQL statement_timestamp() but there is a difference in timezone. SYSDATE returns the time on the server where the database instance is running(returns operating system time) so the time depends on the OS timezone setting. while the

Re: [GENERAL] Postgres 9.1 issues running data directory from VMware shared folder

2014-08-29 Thread Jacob Bunk Nielsen
Arze, Cesar ca...@som.umaryland.edu writes: creating template1 database in /mnt/pg_data/base/1 ... FATAL: could not open file pg_xlog/00010001 (log file 0, segment 1): No such file or directory We've seen something slightly similar when running PostgreSQL in a Linux

Re: [GENERAL] Help related to Postgresql for RHEL 6.5

2014-08-29 Thread David G Johnston
Yogesh. Sharma wrote Dear David, Are you currently using PostgreSQL? Currently we are using PostgreSQL 8.1.18 version on RHEL 5.8. Now we plan to update this to PostgreSQL 9.0 version with RHEL6.5. As in verion 9.0 I found least Compatibilities. So, please guide me. Regards,

[GENERAL] Single Table Report With Calculated Column

2014-08-29 Thread Rich Shepard
I've read some on table partitioning and using nested select statements with group by, but have not found the syntax to produce the needed results. From a table I extract row counts grouped by three columns: select stream, sampdate, func_feed_grp, count(*) from benthos group by stream,

Re: [GENERAL] Single Table Report With Calculated Column

2014-08-29 Thread David G Johnston
Rich Shepard wrote I've read some on table partitioning and using nested select statements with group by, but have not found the syntax to produce the needed results. From a table I extract row counts grouped by three columns: select stream, sampdate, func_feed_grp, count(*) from

[GENERAL] Transforming pg_dump output to be compatible with SQLite 3.x

2014-08-29 Thread Kynn Jones
Greetings! I'm looking for tools/resources/ideas for making pg_dump's output compatible with SQLite v. 3.1.3. Ideally, I'd love to be able to do something like this (Unix): % rm -f mydatabase.db % pg_dump --no-owner --inserts mydatabase | pg_dump2sqlite3 | sqlite3 mydatabase.db ...where

Re: [GENERAL] Transforming pg_dump output to be compatible with SQLite 3.x

2014-08-29 Thread John McKown
On Fri, Aug 29, 2014 at 9:06 AM, Kynn Jones kyn...@gmail.com wrote: Greetings! I'm looking for tools/resources/ideas for making pg_dump's output compatible with SQLite v. 3.1.3. Ideally, I'd love to be able to do something like this (Unix): % rm -f mydatabase.db % pg_dump --no-owner

Re: [GENERAL] Transforming pg_dump output to be compatible with SQLite 3.x

2014-08-29 Thread Adrian Klaver
On 08/29/2014 07:40 AM, John McKown wrote: On Fri, Aug 29, 2014 at 9:06 AM, Kynn Jones kyn...@gmail.com wrote: Greetings! I'm looking for tools/resources/ideas for making pg_dump's output compatible with SQLite v. 3.1.3. Ideally, I'd love to be able to do something like this (Unix): % rm

Re: [GENERAL] Transforming pg_dump output to be compatible with SQLite 3.x

2014-08-29 Thread John McKown
You're correct. It is Friday leading to a 3 day weekend here. And it is a short work day too. So my brain has definitely already left the building. Thanks for pointing that out. I use SQLite some, but just for very basic stuff and am not really familiar with it. Perhaps Kynn could show what, in

Re: [GENERAL] Help related to Postgresql for RHEL 6.5

2014-08-29 Thread Adrian Klaver
On 08/28/2014 09:14 PM, Yogesh. Sharma wrote: Dear David, Are you currently using PostgreSQL? Currently we are using PostgreSQL 8.1.18 version on RHEL 5.8. Now we plan to update this to PostgreSQL 9.0 version with RHEL6.5. As in verion 9.0 I found least Compatibilities. So what are the

Re: [GENERAL] Timezone difference between Oracle SYSDATE and PostgreSQL timestamp functions

2014-08-29 Thread Steve Crawford
On 08/28/2014 10:06 PM, Vinayak wrote: Hello, We have converted Oracle SYSDATE to PostgreSQL statement_timestamp() but there is a difference in timezone. SYSDATE returns the time on the server where the database instance is running(returns operating system time) so the time depends on the OS

[GENERAL] Performance issue with postgres_fdw

2014-08-29 Thread Emmanuel Medernach
Hello, I use Postgres version 9.3.5 and spot a performance issue with postgres_fdw. I have a table object_003_xyz with 275000 lines and is exported to the master node as master_object_003_xyz. ( The following query is only a part of an automatically generated complex query. )

Re: [GENERAL] Single Table Report With Calculated Column

2014-08-29 Thread Rich Shepard
On Fri, 29 Aug 2014, David G Johnston wrote: You want to use window clause/function. David, I read about this, but did not absorb everything. Add the following to the first query, in the select-list: Sum(count(*)) over (partition by stream, sampdate) as stream_date_total You function

Re: [GENERAL] Single Table Report With Calculated Column

2014-08-29 Thread Adrian Klaver
On 08/29/2014 09:50 AM, Rich Shepard wrote: On Fri, 29 Aug 2014, David G Johnston wrote: You want to use window clause/function. David, I read about this, but did not absorb everything. Add the following to the first query, in the select-list: Sum(count(*)) over (partition by stream,

Re: [GENERAL] Single Table Report With Calculated Column

2014-08-29 Thread Rich Shepard
On Fri, 29 Aug 2014, Adrian Klaver wrote: I am going to assume you mean Postgres did not like the syntax. Adrian, Oops! Mea culpa. Yes, postgres. What was the error message you got back? I don't recall. It was yesterday afternoon and I flushed it from memory when it did not work.

[GENERAL] Is there a function to save schema history internally?

2014-08-29 Thread Patrick Dung
Hello Postgresql users, Is there a function to save schema history internally? By keeping the schema history inside the DB, we can keep track of what and when is changed in the schema. While searching google. It seems it is a limitation with the audit trigger:

[GENERAL] alter column to varchar without view drop/re-creation

2014-08-29 Thread Emi Lu
Hello list, May I know is there a way to "alter column type to varchar" (previous is varchar(***)) without view drop/re-creation? Basically, looking for a way to change column without have to drop/re-create dependent views. varchar(***) to varchar

Re: [GENERAL] alter column to varchar without view drop/re-creation

2014-08-29 Thread Emi Lu
Hello list, May I know is there a way to "alter column type to varchar" (previous is varchar(***)) without view drop/re-creation? Basically, looking for a way to change column without have to drop/re-create dependent views.

Re: [GENERAL] alter column to varchar without view drop/re-creation

2014-08-29 Thread Adrian Klaver
On 08/29/2014 12:09 PM, Emi Lu wrote: Hello list, May I know is there a way to alter column type to varchar (previous is varchar(***)) without view drop/re-creation? Basically, looking for a way to change column without have to drop/re-create dependent views. varchar(***) to varchar and no

Re: [GENERAL] Single Table Report With Calculated Column

2014-08-29 Thread Adrian Klaver
On 08/29/2014 10:15 AM, Rich Shepard wrote: On Fri, 29 Aug 2014, Adrian Klaver wrote: I am going to assume you mean Postgres did not like the syntax. Adrian, Oops! Mea culpa. Yes, postgres. What was the error message you got back? I don't recall. It was yesterday afternoon and I

Re: [GENERAL] WAL receive process dies

2014-08-29 Thread Patrick Krecker
Hi Craig -- Sorry for the late response, I've been tied up with some other things for the last day. Just to give some context, this is a machine that sits in our office and replicates from another read slave in production via a tunnel set up with spiped. The spiped tunnel is working and postgres

Re: [GENERAL] WAL receive process dies

2014-08-29 Thread Andres Freund
On 2014-08-29 13:04:43 -0700, Patrick Krecker wrote: Hi Craig -- Sorry for the late response, I've been tied up with some other things for the last day. Just to give some context, this is a machine that sits in our office and replicates from another read slave in production via a tunnel set up

Re: [GENERAL] Is there a function to save schema history internally?

2014-08-29 Thread Adrian Klaver
On 08/29/2014 11:23 AM, Patrick Dung wrote: Hello Postgresql users, Is there a function to save schema history internally? By keeping the schema history inside the DB, we can keep track of what and when is changed in the schema. While searching google. It seems it is a limitation with the

Re: [GENERAL] alter column to varchar without view drop/re-creation

2014-08-29 Thread Emi Lu
Hello, On 08/29/2014 03:16 PM, Adrian Klaver wrote: May I know is there a way to "alter column type to varchar" (previous is varchar(***)) without view drop/re-creation? Basically,

Re: [GENERAL] WAL receive process dies

2014-08-29 Thread Patrick Krecker
On Fri, Aug 29, 2014 at 2:11 PM, Andres Freund and...@2ndquadrant.com wrote: On 2014-08-29 13:04:43 -0700, Patrick Krecker wrote: Hi Craig -- Sorry for the late response, I've been tied up with some other things for the last day. Just to give some context, this is a machine that sits in

Re: [GENERAL] WAL receive process dies

2014-08-29 Thread Andres Freund
[FWIW: proper quoting makes answering easier and thus more likely] On 2014-08-29 15:37:51 -0700, Patrick Krecker wrote: I ran the following on the local endpoint of spiped: while [ true ]; do psql -h localhost -p 5445 judicata -U marbury -c select modtime, pg_last_xlog_receive_location(),

Re: [GENERAL] WAL receive process dies

2014-08-29 Thread Patrick Krecker
On Fri, Aug 29, 2014 at 3:46 PM, Andres Freund and...@2ndquadrant.com wrote: [FWIW: proper quoting makes answering easier and thus more likely] On 2014-08-29 15:37:51 -0700, Patrick Krecker wrote: I ran the following on the local endpoint of spiped: while [ true ]; do psql -h localhost

Re: [GENERAL] Is there a function to save schema history internally?

2014-08-29 Thread Patrick Dung
Hi Adrian, Thanks for the info. Thanks and regards, Patrick On Saturday, August 30, 2014 5:28 AM, Adrian Klaver adrian.kla...@aklaver.com wrote: On 08/29/2014 11:23 AM, Patrick Dung wrote: Hello Postgresql users, Is there a function to save schema history internally? By keeping the

[GENERAL] How to make use of partitioned table for faster query?

2014-08-29 Thread Patrick Dung
Hello Postgresql users, Suppose the table 'attendance' is very large: id bigint student_name varchar late boolean record_timestamp timestamp The table is already partitioned by year (attendance_2012p, attendance_2013p, ...). I would like to count the number of lates by year. Instead of

Re: [GENERAL] How to make use of partitioned table for faster query?

2014-08-29 Thread John R Pierce
On 8/29/2014 9:38 PM, Patrick Dung wrote: Suppose the table 'attendance' is very large: id bigint student_name varchar late boolean record_timestamp timestamp The table is already partitioned by year (attendance_2012p, attendance_2013p, ...). I would like to count the number of lates by year.

Re: [GENERAL] How to make use of partitioned table for faster query?

2014-08-29 Thread Patrick Dung
Thanks for reply. The constraint is like: ADD CONSTRAINT attandence_2014p_record_timestamp_check CHECK (record_timestamp = '2014-01-01 00:00:00'::timestamp without time zone AND record_timestamp '2015-01-01 00:00:00'::timestamp without time zone); Let us assume it is a complete year