Typed hstore proposal
От | Johann 'Myrkraverk' Oskarsson |
---|---|
Тема | Typed hstore proposal |
Дата | |
Msg-id | x6ehvx1jd0.fsf@2ndquadrant.com обсуждение исходный текст |
Ответы |
Re: Typed hstore proposal
Re: Typed hstore proposal |
Список | pgsql-hackers |
Hi all, I mean to create a typed hstore, called tstore for now. I'm open to name suggestions. It'll only support a subset of core Postgres types to begin with. Keys are always text, it's the value that's typed. Usage is very similar to hstore; this is not a complete reference. tstore( text, text) Creates a text key-value pair. tstore( text, int4 ) Creates an integer key-value pair. tstore -> text Returns a tvalue, which is basically an oid-value pair. typeof( tvalue ) Returns the oid. tvalue::int4 The integer value. tvalue::text The text value. each_int( tstore ) Set of all keys and values where the value is int4. each_text( tstore ) Set of all keys and values where the value is text. each( tstore ) Set of all keys and values as tvalues. Some examples: # select 'text: "a"'::tvalue; tvalue ----------text: "a" (1 row) # select 'integer: 17'::tvalue; tvalue ----------int4: 17 (1 row) # select each_int( '"a" -> text: "b", "b" -> int: 17'::tstore );?column? | ?column? ----------+----------"b" | 17 (1 row) #select '"a" -> text: "b", "b" -> int: 17'::tstore -> 'a'; ?column? -----------text: "a" (1 row) All comments are welcome. As the project matures, I'm sure other needed functions will crop up. -- Johann Oskarsson http://www.2ndquadrant.com/ |[] PostgreSQL Development, 24x7 Support, Training andServices --+-- | Blog: http://my.opera.com/myrkraverk/blog/
В списке pgsql-hackers по дате отправления: