Re: From hstore to jsonb (type of column)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alexandre Delanoë <debian(at)delanoe(dot)org>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: From hstore to jsonb (type of column)
Date: 2015-03-31 14:02:39
Message-ID: 16364.1427810559@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Alexandre =?iso-8859-1?Q?Delano=EB?= <debian(at)delanoe(dot)org> writes:
> from hstore to json, I use this:

> ALTER TABLE ONLY mytable
> ALTER COLUMN mycolumn
> TYPE JSON
> USING hstore_to_json(mycolumn)
> ;

> ALTER TABLE ONLY mytable
> ALTER COLUMN mycolumn
> SET DEFAULT '{}'::json
> ;

> But what would it become for jsonb ?

Just do "USING hstore_to_json(mycolumn)::jsonb". Eventually there
will probably be direct jsonb equivalents of all the existing
json transform functions, but they're not all there yet.

regards, tom lane

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Alexandre Delanoë 2015-04-01 15:49:09 Re: From hstore to jsonb (type of column)
Previous Message Florian Schaetz 2015-03-31 09:13:51 Re: Optimize a big matrix select