Re: Interest in serializing composite types?
Chris Travers <[email protected]> Mon, 25 Aug 2014 17:42:50 -0700
| Newsgroups | gmane.comp.db.postgresql.dbdpg |
|---|---|
| Message-ID | <CAKt_ZfsocUu7nmi21xYn2EWtOXKnrCyB-uXP8x=FAkHZbWPYnA@mail.gmail.com> |
On Mon, Aug 25, 2014 at 5:33 PM, Darren Duncan <[email protected]> wrote: > On 2014-08-24, 5:33 PM, Chris Travers wrote: > >> Arrays are at least in theory self-contained. We don't >> have to ask the db how to parse them. Tuples are not (we need to do a >> catalog >> lookup to find the order of elements). >> > > So here's a question ... > > DBI has for a long time given the option for tuples to be returned either > as arrays or as hashes. > > If the ability to choose representation is preserved in the improvements > you're making, then could the extra db lookups be avoided if say the user > choose to get their tuples as arrays instead? The information about field > names is lost, but then the user chose to not want them anyway, as they are > identifying the fields by ordinal position instead. > > DBI defaults to returning tuples from plain SELECTs as arrays, and you > have to ask it if you want hashes; does doing the latter mean a lookup > already that the former doesn't have? So suppose I have an array of tuples, each of which has an array of tuples as a member? Tracking the proper handling of that from the developer's perspective may be difficult. I would rather get text strings where I can check whether it starts with '(' or '{' Best wishes, Chris Travers > > > -- Darren Duncan > > -- Best Wishes, Chris Travers Efficito: Hosted Accounting and ERP. Robust and Flexible. No vendor lock-in. http://www.efficito.com/learn_more