Re: [GENERAL] Installing Postgresql on Linux Friendlyarm

2014-09-24 Thread Xiang Gan
Finally, I managed to run Postgresql in Linux FriendlyARM environment. It seems that Postgresql server starts to work, however, it prints out some WARNING info. during the start. The error info. is as follows: LOG: could not resolve "localhost": Temporary failure in name resolution LOG: disablin

Re: [GENERAL] spgist index not getting used

2014-09-24 Thread Paul Ramsey
Yep, that was a typo (or, rather, an unpushed commit). And yep, the lack of a commutator was the problem.  Thanks so much, it’s a huge relief to see it turning over properly :) now, onwards to actually doing the PostGIS implementation. (On an semi-related note, if the spgist example had been in

Re: [GENERAL] spgist index not getting used

2014-09-24 Thread Tom Lane
Paul Ramsey writes: > My C implementation is here  > https://github.com/pramsey/postgis/blob/spgist/postgis/gserialized_spgist_2d.c > My SQL binding calls are here  > https://github.com/pramsey/postgis/blob/spgist/postgis/gserialized_spgist_2d.sql > Thanks to help from Andres Freund, I can now

Re: [GENERAL] spgist index not getting used

2014-09-24 Thread Paul Ramsey
Still no go. I actually tried a bunch of different selectivity functions too, and the planner correctly used them to estimate the number of potential returned functions, but in no case did the index actually kick in, no matter how selective I made the operator appear.  P. -- http://postgis.

Re: [GENERAL] Synchronous replication + pgPool: not all transactions immediately visible on standby

2014-09-24 Thread Tatsuo Ishii
I think your problem is not relevant to pgpool-II. PostgreSQL's "synchronous" replication is actually not synchronous (it's confusing but the naming was developer's decision). Primary server sends the committed transaction's WAL record to standby and wait for it is written to the standby's WAL fil

Re: [GENERAL] spgist index not getting used

2014-09-24 Thread Peter Geoghegan
On Wed, Sep 24, 2014 at 2:01 PM, Paul Ramsey wrote: > If I build an index on the same table using the internal quad-tree ops, and > use their operator, I do get an index scan. What about when enable_seqscan = off? -- Regards, Peter Geoghegan -- Sent via pgsql-general mailing list (pgsql-gen

[GENERAL] spgist index not getting used

2014-09-24 Thread Paul Ramsey
Hi all, I continue to bang along towards a binding of the spgist api from a run-time extension (postgis, in this case). To avoid complication, I am actually not doing any postgis code at this point, just copying the internal point quadtree implementation and seeing if I can get it to turn over.

Re: [GENERAL] JSONB spaces in text presentation

2014-09-24 Thread Seref Arikan
Thanks Oleg, I'll check the slides. On Wed, Sep 24, 2014 at 8:07 PM, Oleg Bartunov wrote: > Check slides 17-20 of > http://www.sai.msu.su/~megera/postgres/talks/hstore-dublin-2013.pdf to > understand, what 'binary format' means. The slides describes binary storage > for nested hstore, not jsonb

Re: [GENERAL] Transaction completion timing

2014-09-24 Thread Steve Dodd
You could very well be right. We are using JPA under Hibernate, using container managed transactions. So T1 and T2 above are actually container managed transactions, each running in response to REST API requests. They should be bound 1:1 with underlying PostgreSQL transactions, but perhaps t

Re: [GENERAL] How to clone CURRENT_DATE to SYSDATE ?

2014-09-24 Thread Adrian Klaver
On 09/24/2014 07:39 AM, Emanuel Araújo wrote: Hi, I need to clone function CURRENT_DATE to SYSDATE in my PostgreSQL. Does anybody know how to do that it ? Not sure what you want? A clone is an exact replica so cloning CURRENT_DATE would create another CURRENT_DATE. My guess is that this not

Re: [GENERAL] JSONB spaces in text presentation

2014-09-24 Thread John R Pierce
On 9/24/2014 7:22 AM, Seref Arikan wrote: This is interesting. Most binary encoding methods I use produce smaller files than the text files for the same content. '1' vs INTEGER 1 ... 1 byte vs 4 bytes. now add metadata necessary to represent the original json structure. -- john r pierce

Re: [GENERAL] JSONB spaces in text presentation

2014-09-24 Thread Oleg Bartunov
Check slides 17-20 of http://www.sai.msu.su/~megera/postgres/talks/hstore-dublin-2013.pdf to understand, what 'binary format' means. The slides describes binary storage for nested hstore, not jsonb, but you'll get the idea. On Wed, Sep 24, 2014 at 6:22 PM, Seref Arikan wrote: > This is interesti

Re: [GENERAL] Custom type literal conversion

2014-09-24 Thread Chris Bandy
On Wed, Sep 24, 2014 at 8:40 AM, hubert depesz lubaczewski wrote: > On Wed, Sep 24, 2014 at 2:45 PM, Chris Bandy > wrote: > >> I would like to create a new type for version strings that sorts >> numerically. The composite type below was quick to write and does not >> require superuser privileges

Re: [GENERAL] Why can't I select un-grouped columns when grouping by a (non-primary) unique key?

2014-09-24 Thread Tom Lane
Daniel Lenski writes: > Now that I understand PG's current behavior, it doesn't seem like a > huge limitation... but I'm curious about what is preventing the UNIQUE > NOT NULL constraints from being allowed as well. Is there something > different about the internal representation of UNIQUE NOT NUL

Re: [GENERAL] Why can't I select un-grouped columns when grouping by a (non-primary) unique key?

2014-09-24 Thread Daniel Lenski
On Wed, Sep 24, 2014 at 10:37 AM, Alberto Cabello Sánchez wrote: > At first sight, primary key means no grouping at all, as there are no > duplicated A.primary_key values: > > SELECT A.document > FROM A > GROUP BY A.primary_key > > is the same as > > SELECT A.document > FROM A > Y

Re: [GENERAL] Why can't I select un-grouped columns when grouping by a (non-primary) unique key?

2014-09-24 Thread Daniel Lenski
On Wed, Sep 24, 2014 at 10:46 AM, Geoff Montee wrote: > > I believe this blog post contains better examples of the feature he's > referring to: > > http://www.depesz.com/2010/08/08/waiting-for-9-1-recognize-functional-dependency-on-primary-keys/ > > For example: > > SELECT > p.id, > p.firs

Re: [GENERAL] Transaction completion timing

2014-09-24 Thread Tom Lane
"Steve Dodd" writes: > Say we have two transactions run sequentially: T1 writes some data, and T2 > reads the written data. There is a non-zero time delay between the apparent > T1 commit, and the subsequent T2 query. > Is there any guarantee that the data written in T1 will be visible to the >

[GENERAL] Transaction completion timing

2014-09-24 Thread Steve Dodd
Say we have two transactions run sequentially: T1 writes some data, and T2 reads the written data. There is a non-zero time delay between the apparent T1 commit, and the subsequent T2 query. Is there any guarantee that the data written in T1 will be visible to the query in T2? We have a situ

Re: [GENERAL] Why can't I select un-grouped columns when grouping by a (non-primary) unique key?

2014-09-24 Thread Geoff Montee
On Wed, Sep 24, 2014 at 1:37 PM, Alberto Cabello Sánchez wrote: > > On Wed, 24 Sep 2014 09:04:21 -0700 > Daniel Lenski wrote: > > > If I include the primary key of a table in my GROUP BY clause, PG 9.3 > > allows me to refer to other columns of that table without explicit GROUP BY: > > > > Why do

Re: [GENERAL] Why can't I select un-grouped columns when grouping by a (non-primary) unique key?

2014-09-24 Thread Alberto Cabello Sánchez
On Wed, 24 Sep 2014 09:04:21 -0700 Daniel Lenski wrote: > If I include the primary key of a table in my GROUP BY clause, PG 9.3 > allows me to refer to other columns of that table without explicit GROUP BY: > > Why doesn't the same thing work with a non-NULL unique constraint? At first sight, p

Re: [GENERAL] deadlock of lock-waits (on transaction and on tuple) using same update statement

2014-09-24 Thread Bill Moran
On Tue, 23 Sep 2014 20:00:27 +0200 Andrej Vanek wrote: > Hi, > > My application runs many concurrent sessions with the same transaction code > starting with an update statement. > I would expect locking and serialization of those transactions. But I get > unexpected deadlocks. > As opposed to *h

Re: [GENERAL] JSONB spaces in text presentation

2014-09-24 Thread Ilya I. Ashchepkov
With the same data: # create cast (jsonb as bytea) without function; # select sum(length(data::text))::float/sum(octet_length((data::jsonb)::bytea)) from data.packets; ?column? --- 0.630663654967513 and 0.554666142734544 without spaces On Wed, Sep 24, 2014 at 9:22 PM, Seref

Re: [GENERAL] Question about row_number() ordering semantics

2014-09-24 Thread Tom Lane
Fred Jonsson writes: > As I was playing around with `row_number()`s for cursor-based pagination, I > came across some ordering behavior that I didn't expect. > In particular, when I order in a way where multiple rows compete for the > same position in the result set (i.e., rows that are equivalen

Re: [GENERAL] JSONB spaces in text presentation

2014-09-24 Thread Ilya I. Ashchepkov
IMHO, prettification is useful only for debugging. It would be nice to have a session variable for the debug output with spaces, new lines and indentation. On Wed, Sep 24, 2014 at 8:44 PM, Merlin Moncure wrote: > On Wed, Sep 24, 2014 at 2:44 AM, Ilya I. Ashchepkov > wrote: > > I'm sorry about s

[GENERAL] Why can't I select un-grouped columns when grouping by a (non-primary) unique key?

2014-09-24 Thread Daniel Lenski
If I include the primary key of a table in my GROUP BY clause, PG 9.3 allows me to refer to other columns of that table without explicit GROUP BY: CREATE TABLE A (id SERIAL PRIMARY KEY, name TEXT UNIQUE NOT NULL, document JSON); -- this works fine SELECT A.document FROM A GROU

Re: [GENERAL] [ADMIN] readonly user

2014-09-24 Thread Geoff Winkless
On 24 September 2014 15:45, Stefan Carl wrote: > ALTER DEFAULT PRIVILEGES FOR ddl_user IN SCHEMA public GRANT SELECT ON > TABLES TO > readonly; > ALTER DEFAULT PRIVILEGES FOR ddl_user IN SCHEMA public GRANT SELECT ON > SEQUENCES > TO readonly; > ALTER DEFAULT PRIVILEGES FOR ddl_user IN SCHEMA pub

[GENERAL] Question about row_number() ordering semantics

2014-09-24 Thread Fred Jonsson
Hey everyone, As I was playing around with `row_number()`s for cursor-based pagination, I came across some ordering behavior that I didn't expect. In particular, when I order in a way where multiple rows compete for the same position in the result set (i.e., rows that are equivalent in terms of t

[GENERAL] readonly user

2014-09-24 Thread Stefan Carl
Dear List,   i work with a PostgreSQL/PostGIS-database (version 9.1.14/1.5.3) to manage geodata and other data.   Now i want to create a login-role, that only enable readonly rights for the data. I easy find hints to the GRANT-command and i created a login-role "readonly" and modify the permis

[GENERAL] How to clone CURRENT_DATE to SYSDATE ?

2014-09-24 Thread Emanuel Araújo
Hi, I need to clone function CURRENT_DATE to SYSDATE in my PostgreSQL. Does anybody know how to do that it ? -- *Atenciosamente,Emanuel Araújo* *Linux Certified, DBA PostgreSQL*

Re: [GENERAL] JSONB spaces in text presentation

2014-09-24 Thread Adrian Klaver
On 09/24/2014 07:22 AM, Seref Arikan wrote: This is interesting. Most binary encoding methods I use produce smaller files than the text files for the same content. Having read your mail, I've realized that I have no reason to accept the same from the jsonb. I did a quick google search to see if i

Re: [GENERAL] JSONB spaces in text presentation

2014-09-24 Thread Seref Arikan
This is interesting. Most binary encoding methods I use produce smaller files than the text files for the same content. Having read your mail, I've realized that I have no reason to accept the same from the jsonb. I did a quick google search to see if it is wrong to expect binary encoding to decrea

Re: [GENERAL] JSONB spaces in text presentation

2014-09-24 Thread Adrian Klaver
On 09/24/2014 12:44 AM, Ilya I. Ashchepkov wrote: I'm sorry about sending email several times. I haven't understand, was it sent by gmail or not. On Wed, Sep 24, 2014 at 2:30 PM, John R Pierce mailto:pie...@hogranch.com>> wrote: On 9/24/2014 12:23 AM, Ilya I. Ashchepkov wrote: Is

Re: [GENERAL] JSONB spaces in text presentation

2014-09-24 Thread Merlin Moncure
On Wed, Sep 24, 2014 at 2:44 AM, Ilya I. Ashchepkov wrote: > I'm sorry about sending email several times. I haven't understand, was it > sent by gmail or not. > > > On Wed, Sep 24, 2014 at 2:30 PM, John R Pierce wrote: >> >> On 9/24/2014 12:23 AM, Ilya I. Ashchepkov wrote: >>> >>> >>> Is spaces i

Re: [GENERAL] Custom type literal conversion

2014-09-24 Thread hubert depesz lubaczewski
On Wed, Sep 24, 2014 at 2:45 PM, Chris Bandy wrote: > I would like to create a new type for version strings that sorts > numerically. The composite type below was quick to write and does not > require superuser privileges. However, it doesn't respond to type casts the > way I'd like. > > Is there

[GENERAL] Custom type literal conversion

2014-09-24 Thread Chris Bandy
I would like to create a new type for version strings that sorts numerically. The composite type below was quick to write and does not require superuser privileges. However, it doesn't respond to type casts the way I'd like. Is there a way to implement this type's literal conversion without resort

Re: [GENERAL] pg_dump: [archiver] -C and -c are incompatible options

2014-09-24 Thread Tom Lane
David G Johnston writes: > Tom Lane-2 wrote >> Like it says, you should not use both the -C and -c command-line options >> to pg_dump. I'm not sure how that translates to what you're doing in >> pgAdmin3, but presumably you're selecting some incompatible options there. >> >> You might want to gr

[GENERAL] Synchronous replication + pgPool: not all transactions immediately visible on standby

2014-09-24 Thread Thomas Kellerer
Hello, we have a setup with Postgres 9.3.4 running on Ubuntu (don't know the exact version) using streaming replication with a hot standby and pgPool 3.3.3 as a loadbalancer in front of the two Postgres servers. While running automated tests we noticed that despite the fact that replication is

Re: [GENERAL] JSONB spaces in text presentation

2014-09-24 Thread Ilya I. Ashchepkov
I'm sorry about sending email several times. I haven't understand, was it sent by gmail or not. On Wed, Sep 24, 2014 at 2:30 PM, John R Pierce wrote: > On 9/24/2014 12:23 AM, Ilya I. Ashchepkov wrote: > >> >> Is spaces is necessary in text presentation of JSONB? >> In my data resulting text con

Re: [GENERAL] JSONB spaces in text presentation

2014-09-24 Thread John R Pierce
On 9/24/2014 12:23 AM, Ilya I. Ashchepkov wrote: Is spaces is necessary in text presentation of JSONB? In my data resulting text contains ~12% of spaces. can you show us an example of this? -- john r pierce 37N 122W somewhere on the middle of the left coa

[GENERAL] JSONB spaces in text presentation

2014-09-24 Thread Ilya I. Ashchepkov
Hi. Is spaces is nessesary in text presentation of JSONB? In my data resulting text contains ~12% of spaces. I'm developing web application, and want to get json-string from pg and send it to browser without repacking. -- С уважением, Ащепков Илья koc...@gmail.com

[GENERAL] JSONB spaces in text presentation

2014-09-24 Thread Ilya I. Ashchepkov
Hi. Is spaces is necessary in text presentation of JSONB? In my data resulting text contains ~12% of spaces. I'm developing web application, and want to get json-string from pg and send it to browser without repacking. -- С уважением, Ащепков Илья koc...@gmail.com