[GENERAL] Postgresql and GlassFish - cannot commit when autoCommit is enabled

2015-05-07 Thread Александр Свиридов
I have postgresql 9.4 and glassfish 4.1. Besides I use MyBatis inside EJB. Now I try to make select from table and this is what I get: javax.resource.spi.LocalTransactionException:Cannot commit when autoCommit is enabled. at com.sun.gjc.spi.LocalTransactionImpl.commit(LocalTransactionImpl.

Re: [GENERAL] detached query?

2015-05-07 Thread Tim Clarke
We do this nohup psql -U (username) -W -f (sqlquery script) (database) && on our linux boxes all the time to run a long query or sequence of them. If its a scheduled job it just goes into cron and you don't need the "nohup" or trailing "&&". Let me know if you'd like me to break all that apart f

[GENERAL] count distinct and group by

2015-05-07 Thread Szymon Guz
Hi, I'm not sure why there is a reason for such behaviour. For this table: create table bg(id serial primary key, t text); This works: select count(id) from bg; This works: select count(distinct id) from bg; And this doesn't: select count(distinct id) from bg order by id; ERROR: column "bg

Re: [GENERAL] count distinct and group by

2015-05-07 Thread Magnus Hagander
On Thu, May 7, 2015 at 12:23 PM, Szymon Guz wrote: > Hi, > I'm not sure why there is a reason for such behaviour. > > For this table: > > create table bg(id serial primary key, t text); > > This works: > > select count(id) from bg; > > This works: > > select count(distinct id) from bg; > > And th

Re: [GENERAL] count distinct and group by

2015-05-07 Thread Geoff Winkless
On 7 May 2015 at 11:23, Szymon Guz wrote: > Hi, > I'm not sure why there is a reason for such behaviour. > > select count(distinct id) from bg order by id; > ERROR: column "bg.id" must appear in the GROUP BY clause or be used in > an aggregate function > LINE 1: select count(distinct id) from bg

Re: [GENERAL] count distinct and group by

2015-05-07 Thread Andomar
And this doesn't: select count(distinct id) from bg order by id; ERROR: column "bg.id " must appear in the GROUP BY clause or be used in an aggregate function LINE 1: select count(distinct id) from bg order by id; Your result set will contain one row with the count of distinct i

Re: [GENERAL] count distinct and group by

2015-05-07 Thread Szymon Guz
On 7 May 2015 at 12:39, Magnus Hagander wrote: > On Thu, May 7, 2015 at 12:23 PM, Szymon Guz wrote: > >> Hi, >> I'm not sure why there is a reason for such behaviour. >> >> For this table: >> >> create table bg(id serial primary key, t text); >> >> This works: >> >> select count(id) from bg; >>

Re: [GENERAL] count distinct and group by

2015-05-07 Thread Thomas Kellerer
Geoff Winkless schrieb am 07.05.2015 um 12:39: > in Postgres (unlike MySQL) you can't order a list of values by a column you > haven't selected.​ Of course you can, just not when you are aggregating. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to you

Re: [GENERAL] count distinct and group by

2015-05-07 Thread Geoff Winkless
On 7 May 2015 at 11:54, Thomas Kellerer wrote: > Geoff Winkless schrieb am 07.05.2015 um 12:39: > > in Postgres (unlike MySQL) you can't order a list of values by a column > you haven't selected.​ > > Of course you can, just not when you are aggregating. > > ​Doh! I missed out that key clause :)

Re: [GENERAL] Getting UDR up and running

2015-05-07 Thread cchee-ob
I used the BDR 0.10.0 Documentation to set up UDR. Basically you set the UDR node the same way as a BDR node and you use the bdr.bdr_subscribe function to subscribe to the node that you ran the brr.bdr_group_create function on. It works great! The only caveat is that if you are running any DDL

[GENERAL] Hash function constant in the Hash join algorithm

2015-05-07 Thread Ravi Kiran
Hi, As part part of my project, I had to compare the time taken by the Hashjoin algorithm to that of Nested loop algorithm for the inner join and Natural join queries, under two cases. I used six tables to join each other each containing 5000 rows each approximately. The two cases are given bel

Re: [GENERAL] Hash function constant in the Hash join algorithm

2015-05-07 Thread Tom Lane
Ravi Kiran writes: > From the above two cases, I am understanding that even even when the hash > function is made to return a constant, The hashjoin agorithm is taking > significantly lower time compared to nested loop. > Could anyone explain why does the hashjoin algorithm takes significantly >

Re: [GENERAL] Any freeware graphic display of DDL software available?

2015-05-07 Thread Rajiv M Ranganath
If you use Amazon Linux on EC2, we have packaged SchemaSpy support for it. More details are here, https://lambda-linux.io/blog/2015/05/07/announcing-schemaspy-support-for-amazon-linux/ Best, Rajiv On Thu, Jan 16, 2014 at 7:46 PM, Merlin Moncure wrote: > On Thu, Jan 16, 2014 at 10:45 AM, Susan C

[GENERAL] Streaming replication and an archivelog

2015-05-07 Thread James Sewell
Hello All, I am running 9.4 on Centos. I have three servers, one master and two slaves. The slaves have the following recovery.conf standby_mode = 'on' primary_conninfo = 'user=postgres host=mastervip port=5432' restore_command = 'scp -o BatchMode=yes postgres@backuphost:/archived_wals/%f %p' re

Re: [GENERAL] Streaming replication and an archivelog

2015-05-07 Thread James Sewell
Hey, This is an example of what I see when starting up a replica and attaching it to a master. In this case the master is in timeline 3, but the archive log goes up to timeline 6. 2015-05-08 16:23:07 AEST @ ( 0 0)LOG: database system was interrupted; last known up at 2015-05-08 16:21:14 AES