Modify

Ticket #97 (assigned enhancement)

Opened 8 years ago

Last modified 3 weeks ago

Array support

Reported by: jtv Owned by: jtv
Priority: high Milestone: 3.1
Component: datatypes Version: 3.0
Severity: Incomplete Keywords:
Cc:

Description (last modified by jtv) (diff)

Joris van Zwieten  requests support for postgres  array types.

At the moment arrays can only be manipulated and queried in SQL, or generated and parsed as text. It would be nice to help users get around the latter if we can.

Container and stream interfaces seem the most appropriate. We'd want to be able to construct input arrays from either a field or a string.

There are a few gotchas:

  • Separators between array elements are defined by the contained type. Usually the comma separates elements, but the Box type for example uses a semicolon. It could be anything. We'll have to query that at runtime, and cache the information somehow.
  • Arrays can be nested. We'd probably want to check that all elements are arrays (or nulls) before going into deeper nesting levels.
  • Quoting of array elements may be awkward--we'd have to have separate "treatments" just like we do for prepared statements.
  • How do we specify nulls when creating an array?
  • There is no real "end" to an array: there just comes a point where all else is null. On the C++ end we'd probably want more C++-like semantics, setting end() just past the last non-null element. But what if the last element in an array is null? Programs may break if they hit an unexpected end. We'd need more tolerant semantics: X.end()+1==X.end() and X.end()->is_null()==true.
  • It would be nice to allow direct array indexing in a result ("r[row][col][i]") but it does complicate the result class a bit further.
  • Array lengths aren't enforced by the backend (at least not in 8.2). It's tempting to stick to an array's declared length, but if we do, we must still accept out-of-bounds addressing.

Finally there is the encoding problem in the case of arrays of strings (or arrays of arrays of strings etc.). Parsing a string as an array of strings can go haywire in multibyte encodings that allow byte values equivalent to the closing quote inside a multibyte character. To get around that we'd need to know at least where the character boundaries are--which in turn depends on the encoding being used.

Attachments

Change History

comment:1 Changed 8 years ago by jtv

  • Status changed from new to assigned
  • Description modified (diff)

comment:2 Changed 8 years ago by jtv

  • Milestone set to 2.6.10

comment:3 Changed 8 years ago by jtv

  • Description modified (diff)

comment:4 Changed 8 years ago by jtv

  • Description modified (diff)

comment:5 Changed 8 years ago by jtv

  • Description modified (diff)

comment:6 Changed 8 years ago by jtv

  • Description modified (diff)

comment:7 Changed 6 years ago by jtv

  • Milestone changed from 2.6.10 to 3.1

comment:8 Changed 5 years ago by jtv

  • Milestone 3.1 deleted

comment:9 Changed 5 years ago by jtv

Waiting for libpq to add support.

comment:10 Changed 4 years ago by jtv

  • Severity changed from normal to Incomplete

comment:11 Changed 3 weeks ago by RichardWef

  • Version set to 3.0
  • Milestone set to 3.1

Largely base contestants emit a also great eurasian pressure.  https://my.swu.edu/ICS/icsfs/tabfen33.html?target=aa083c60-c6be-4268-be58-dd77cc746d1e One classroom with available wolves is that about they have been ill online to scratch.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as assigned
as The resolution will be set. Next status will be 'closed'
to The owner will be changed from jtv. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.