Re: [GENERAL] Re: Feature proposal and discussion: full-fledged column/function equivalence

2014-08-01 Thread David Johnston
On Fri, Aug 1, 2014 at 6:22 PM, Chris Travers wrote: > On Fri, Aug 1, 2014 at 12:19 PM, David G Johnston < > david.g.johns...@gmail.com> wrote: > >> Vik Fearing wrote >> >> CREATE testfunction(test) returns int language sql as $$ select 1; $$; >> >> SELECT testfunction FROM test; >> >> >> >> That

Re: [GENERAL] Upgrading from 9.0.11 to 9.3.5 on CentOS 6 (64 bit)

2014-08-01 Thread John R Pierce
On 8/1/2014 6:31 PM, Phoenix Kiula wrote: What's the best way to get to 9.0.18, as a start? Is there a simple single command I can use? I'm on CentOS 6, 64bit. assuming you installed 9.0 from the yum.postgresql.com respositories, then, `yum update postgresql90-server` and restart the postgr

Re: [GENERAL] Upgrading from 9.0.11 to 9.3.5 on CentOS 6 (64 bit)

2014-08-01 Thread Phoenix Kiula
Thank you John. > you can upgrade to 9.0.18 painlessly. 9.1 or .2 or .3, not quite so > painless. What's the best way to get to 9.0.18, as a start? Is there a simple single command I can use? I'm on CentOS 6, 64bit. > have you tried a vacuum full of the whole cluster, with your applicatio

Re: [GENERAL] Re: Feature proposal and discussion: full-fledged column/function equivalence

2014-08-01 Thread Chris Travers
On Fri, Aug 1, 2014 at 12:19 PM, David G Johnston < david.g.johns...@gmail.com> wrote: > Vik Fearing wrote > >> CREATE testfunction(test) returns int language sql as $$ select 1; $$; > >> SELECT testfunction FROM test; > >> > >> That would allow first-class calculated columns. > >> > >> I assume t

[GENERAL] Re: Feature proposal and discussion: full-fledged column/function equivalence

2014-08-01 Thread David G Johnston
Vik Fearing wrote >> CREATE testfunction(test) returns int language sql as $$ select 1; $$; >> SELECT testfunction FROM test; >> >> That would allow first-class calculated columns. >> >> I assume the work is mostly at the parser/grammatical level. Is there >> any reason why supporting that would

Re: [GENERAL] Very Limited Toast Compression on JSONB (9.4 beta 2)

2014-08-01 Thread Larry White
Reported as bug #11109. On Fri, Aug 1, 2014 at 1:46 PM, Larry White wrote: > Jeff, > > Thank you for your help. This is a Postgres bug, but I don't think I'd > have figured it out without your help. > > What is happening is that if PG can, after compression, put the entire > 'document' into one

Re: [GENERAL] Very Limited Toast Compression on JSONB (9.4 beta 2)

2014-08-01 Thread Larry White
Jeff, Thank you for your help. This is a Postgres bug, but I don't think I'd have figured it out without your help. What is happening is that if PG can, after compression, put the entire 'document' into one row/page in the toast table it does. However, if the document is too big to fit in one row

Re: [GENERAL] jsonb creation functions?

2014-08-01 Thread Christoph Moench-Tegeder
Hi, > There is a set of creation functions for json, such as: > > to_json(anyelement) > > There doesn't seem to be any equivalent functions for converting text to > jsonb. > > Is there a way to do this? You can always cast json to jsonb: test_db=# create table t (a integer primary key, b json

Re: [GENERAL] Very Limited Toast Compression on JSONB (9.4 beta 2)

2014-08-01 Thread Jeff Janes
On Thu, Jul 31, 2014 at 11:36 PM, Larry White wrote: > > On Fri, Aug 1, 2014 at 2:20 AM, Jeff Janes wrote: > >> On Thursday, July 31, 2014, Larry White wrote: >> >>> Hi, >>> >>> I'm running an experiment on 9.4 beta 2. >>> >>> I put 275,000 identical JSON files into a table using JSONB (one pe

Re: [GENERAL] Feature proposal and discussion: full-fledged column/function equivalence

2014-08-01 Thread Vik Fearing
On 08/01/2014 06:28 PM, Vik Fearing wrote: >> So with all this in mind, is there any reason why we can't or shouldn't >> > allow: >> > >> > CREATE testfunction(test) returns int language sql as $$ select 1; $$; >> > SELECT testfunction FROM test; >> > >> > That would allow first-class calculated

Re: [GENERAL] Feature proposal and discussion: full-fledged column/function equivalence

2014-08-01 Thread Vik Fearing
On 08/01/2014 04:57 PM, Chris Travers wrote: > Hi all; > > I had a pleasant surprise today when demonstrating a previous misfeature > in PostgreSQL behaved unexpectedly. In further investigation, there is > a really interesting syntax which is very helpful for some things I had > not known about.

Re: [GENERAL] Re: User-defined operator function: what parameter type to use for uncast character string?

2014-08-01 Thread Tom Lane
Adam Mackler writes: > One final question: the 'CREATE CAST' command got my interest. I'm > assuming that when the docs say it 'performs a conversion between two > data types,' that the meaning of "data type" includes only those > created using 'CREATE TYPE' and excludes domains. If I am mistake

[GENERAL] jsonb creation functions?

2014-08-01 Thread Larry White
There is a set of creation functions for json, such as: to_json(anyelement) There doesn't seem to be any equivalent functions for converting text to jsonb. Is there a way to do this? Thanks.

[GENERAL] Feature proposal and discussion: full-fledged column/function equivalence

2014-08-01 Thread Chris Travers
Hi all; I had a pleasant surprise today when demonstrating a previous misfeature in PostgreSQL behaved unexpectedly. In further investigation, there is a really interesting syntax which is very helpful for some things I had not known about. Consider the following: CREATE TABLE keyvaltest (

Re: [GENERAL] Very Limited Toast Compression on JSONB (9.4 beta 2)

2014-08-01 Thread Larry White
There is no TOAST compression on JSON or JSONB data in 9.4 beta 2. I'm not sure about other versions. I'm also not sure if this is a bug or by design, but if it is by design, I think the documentation should be updated. Here is a summary of my results inserting 10,000 highly compressible JSON doc

Re: [GENERAL] Re: Is it possible to create an index without keeping the indexed data in a column?

2014-08-01 Thread Larry White
Thank you David and Amit. This is more or less what I was looking for. I _think_ I might be able to store the data as TEXT, which is highly compressed by Toast, and then perhaps write the function in terms of a TEXT to JSONB conversion. I will give it a try. It might perform terribly, but will be

Re: [GENERAL] How to implement a uniqueness constraint across multiple tables?

2014-08-01 Thread Kynn Jones
On Thu, Jul 31, 2014 at 3:52 PM, Kevin Grittner wrote: This goes beyond the capabilities of declarative constraints to > enforce. You can enforce it using triggers, but you need to handle > race conditions, which is not easy with MVCC behavior (where reads > don't block anything and writes don't

Re: [GENERAL] How to implement a uniqueness constraint across multiple tables?

2014-08-01 Thread Kynn Jones
On Thu, Jul 31, 2014 at 3:19 PM, Rob Sargent wrote: > > Wouldn't this be a problem only if new subn() could/would re-use an id? > if new sub() generates a unique id, there would be no chance of two subn > entries having the same id. > I'd thought that the ids of the sub_k tables were never gener

Re: [GENERAL] How to implement a uniqueness constraint across multiple tables?

2014-08-01 Thread Alban Hertroys
On 31 Jul 2014, at 20:38, Kynn Jones wrote: > I want to implement something akin to OO inheritance among DB tables. The > idea is to define some "superclass" table, e.g.: > > CREATE TABLE super ( > super_id INT PRIMARY KEY, > ... > -- other columns > ); > >

Re: [GENERAL] Re: How to implement a uniqueness constraint across multiple tables?

2014-08-01 Thread Pujol Mathieu
Le 01/08/2014 09:28, David G Johnston a écrit : Pujol Mathieu wrote Le 31/07/2014 20:38, Kynn Jones a écrit : I want to implement something akin to OO inheritance among DB tables. The idea is to define some "superclass" table, e.g.: (BTW, one could use PostgreSQL built-in support for table in

[GENERAL] Re: User-defined operator function: what parameter type to use for uncast character string?

2014-08-01 Thread David G Johnston
On Thursday, July 31, 2014, Adam Mackler-5 [via PostgreSQL] < ml-node+s1045698n5813494...@n5.nabble.com > wrote: > On Thu, Jul 31, 2014 at 10:03:00AM -0400, Tom Lane wrote: > > 2. text is the preferred type among the string class, so any case where > > you have text on one side and some other stri

[GENERAL] Re: How to implement a uniqueness constraint across multiple tables?

2014-08-01 Thread David G Johnston
Pujol Mathieu wrote > Le 31/07/2014 20:38, Kynn Jones a écrit : >> I want to implement something akin to OO inheritance among DB tables. >> The idea is to define some "superclass" table, e.g.: >> >> (BTW, one could use PostgreSQL built-in support for table inheritance >> to implement something v

Re: [GENERAL] How to implement a uniqueness constraint across multiple tables?

2014-08-01 Thread Pujol Mathieu
Le 31/07/2014 20:38, Kynn Jones a écrit : I want to implement something akin to OO inheritance among DB tables. The idea is to define some "superclass" table, e.g.: CREATE TABLE super ( super_id INT PRIMARY KEY, ... -- other columns ); CREATE TABLE sub_1 (

[GENERAL] Re: Is it possible to create an index without keeping the indexed data in a column?

2014-08-01 Thread David G Johnston
larrry wrote > Hi, > > I would like to create a GIN index on a set of JSON documents. Right now > I'm storing the data in a JSONB column. The current index looks like this: > > CREATE INDEX document_payload_idx > ON document > USING gin > (payload jsonb_path_ops); > > The index is pretty s

[GENERAL] Re: Is it possible to create an index without keeping the indexed data in a column?

2014-08-01 Thread David G Johnston
Amit Langote wrote > On Fri, Aug 1, 2014 at 2:50 PM, Amit Langote < > amitlangote09@ > > wrote: >> >> Not sure exactly if it applies here; > > Re-reading the OP again, perhaps it doesn't. Sorry about the noise This is a functional index which lets you store derived data in the index without hav