hstore syntax

From: Kaare Rasmussen <kaare(at)jasonic(dot)dk>
To: pgsql-general(at)postgresql(dot)org
Subject: hstore syntax
Date: 2013-12-08 10:22:41
Message-ID: 52A44871.4000408@jasonic.dk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi

Trying to write a sql function to return hstore generated from a select.
But I'm thinking there must be a better way.

SELECT 'key => "' || s.part || '"')::hstore

is neither pretty nor secure. At least I need to escape any '"' in
s.part. I'll do so if there's no better way to write this (?)

Also, it seems there's no length or size function for hstore? This is
what I've got working now array_length(akeys(s.hstore_field), 1). It
seems to be a rather long way to do it, but it works.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Magnus Hagander 2013-12-08 10:45:04 Re: hstore syntax
Previous Message Eliott 2013-12-08 00:18:16 Re: Constantly increasing per connection memory usage on pg 9.2