Re: [PyGreSQL] PyGreSQL #72: Support arrays with start index != 1

2019-04-25 Thread PyGreSQL issue tracker
#72: Support arrays with start index != 1
--+
  Reporter:  cito |  Owner:
  Type:  enhancement  | Status:  new
  Priority:  minor|  Milestone:  6.0
 Component:  DB API 2 |Version:  5.0
Resolution:   |   Keywords:  array cast
--+

Comment (by cito):

 Idea: Instead of setting the `lower` attribute, the array parser could
 also pass the start index when creating the array e.g. like
 `PgArray(lower=7)`.

--
Ticket URL: 
PyGreSQL 
PyGreSQL Tracker
___
PyGreSQL mailing list
PyGreSQL@Vex.Net
https://mail.vex.net/mailman/listinfo/pygresql


Re: [PyGreSQL] PyGreSQL #72: Support arrays with start index != 1

2016-09-23 Thread PyGreSQL issue tracker
#72: Support arrays with start index != 1
--+
  Reporter:  cito |  Owner:
  Type:  enhancement  | Status:  new
  Priority:  major|  Milestone:  5.1
 Component:  DB API 2 |Version:  5.0
Resolution:   |   Keywords:  array cast
--+
Description changed by cito:

Old description:

> The current implementation of the `cast_array` function in the C module
> ignores the start index of PostgreSQL arrays. They are assumed to always
> be 1. As discussed on the mailing list in September 2016, this should be
> improved:
>
> The idea is that the `cast_array` function should take an additonal,
> optional `cls` parameter which will then be used as the base class for
> the array. If that parameter is `None` or `list`, then the method works
> as before, returning a list or a list of lists for multidimensional
> arrays. If it is any other class, then this will be considered as a
> subclass of list that will be used instead of the builtin list for
> building the return values. In addition, the instances of this list
> subclass will have a `lower` attribute set to the start index of the
> corresponding PostgreSQL (sub)arrays by the `cast_array` function.
>
> It should then be possible to change the default value for `cls` passed
> into the `cast_array` function to a custom list subclass. That subclass
> could consider the start index when getting items, and return `None` it
> the index points to outside the array. This would emulate the behavior of
> PostgreSQL arrays more closely.

New description:

 The current implementation of the `cast_array` function in the C module
 ignores the start index of PostgreSQL arrays. They are assumed to always
 be 1. As discussed on the mailing list in September 2016, this should be
 improved:

 The idea is that the `cast_array` function should take an additonal,
 optional `cls` parameter which will then be used as the base class for the
 array. If that parameter is `None` or `list`, then the method works as
 before, returning a list or a list of lists for multidimensional arrays.
 If it is any other class, then this will be considered as a subclass of
 list that will be used instead of the builtin list for building the return
 values. In addition, the instances of this list subclass will have a
 `lower` attribute set to the start index of the corresponding PostgreSQL
 (sub)arrays by the `cast_array` function.

 It should then be possible to change the default value for `cls` passed
 into the `cast_array` function to a custom list subclass. That subclass
 could consider the start index when getting items, and return `None` it
 the index points to outside the array. This would emulate the behavior of
 PostgreSQL arrays more closely.

 Note that when we support start indices when converting Pg to Py, we also
 need to support them when converting from Py to Pg. Currently this is done
 with the ARRAY constructor, which doesn't allow for start indices as far
 as I know, so this needs to be changed.

--

--
Ticket URL: 
PyGreSQL 
PyGreSQL Tracker
___
PyGreSQL mailing list
PyGreSQL@vex.net
https://mail.vex.net/mailman/listinfo.cgi/pygresql