On Sun, Jan 19, 2014 at 1:41 AM, Pavel Stehule pavel.steh...@gmail.com wrote:
2014/1/19 Marko Tiikkaja ma...@joh.to
On 1/19/14, 12:21 AM, Pavel Stehule wrote:
I checked it and I got a small issue
bash-4.1$ patch -p1 cardinality.patch
(Stripping trailing CRs from patch.)
not sure about
On 1/21/14, 6:42 PM, Robert Haas wrote:
On Sun, Jan 19, 2014 at 1:41 AM, Pavel Stehule pavel.steh...@gmail.com wrote:
It can be problem on my side - some strange combination of mime type. I seen
this issue before. I will recheck it tomorrow from other computer.
Doesn't matter anyway. Patch
On 19 January 2014 11:43, Marko Tiikkaja ma...@joh.to wrote:
New version attached, without the doc change.
This looks good to me.
- applies cleanly.
- compiles with no warnings.
- passes a sensible set of new regression tests.
- implements the agreed behaviour, per SQL spec.
- I can't
On 1/20/14 2:29 PM, Dean Rasheed wrote:
I think this is ready for committer
Thanks!
... although I would also like to see
the doc changes to make the table of array function descriptions a bit
more explicit about corner cases.
Hmm. I completely missed the fact that unnest() already uses a
On 20 January 2014 13:47, Marko Tiikkaja ma...@joh.to wrote:
On 1/20/14 2:29 PM, Dean Rasheed wrote:
I think this is ready for committer
Thanks!
... although I would also like to see
the doc changes to make the table of array function descriptions a bit
more explicit about corner cases.
On 18 January 2014 03:07, Marko Tiikkaja ma...@joh.to wrote:
On 1/12/14, 5:53 AM, I wrote:
On 1/9/14, 2:57 PM, Dean Rasheed wrote:
How it should behave for multi-dimensional arrays is less clear, but
I'd argue that it should return the total number of elements, i.e.
On 1/19/14, 9:12 AM, Dean Rasheed wrote:
On 18 January 2014 03:07, Marko Tiikkaja ma...@joh.to wrote:
Here's the patch as promised. Thoughts?
A couple of points:
The answer for empty (zero dimensional) arrays is wrong --- you need
special case handling for this case to return 0.
How
On 19 January 2014 11:43, Marko Tiikkaja ma...@joh.to wrote:
On 1/19/14, 9:12 AM, Dean Rasheed wrote:
On 18 January 2014 03:07, Marko Tiikkaja ma...@joh.to wrote:
Here's the patch as promised. Thoughts?
A couple of points:
The answer for empty (zero dimensional) arrays is wrong ---
On 1/19/14, 2:12 PM, Dean Rasheed wrote:
That might seem overly pedantic, but it's quite annoying when API
documentation doesn't fully specify the behaviour, and you're forced
to use trial-and-error to find out how the functions behave.
For what it's worth, I was thinking the same thing when I
Hello
I checked it and I got a small issue
bash-4.1$ patch -p1 cardinality.patch
(Stripping trailing CRs from patch.)
patching file doc/src/sgml/array.sgml
(Stripping trailing CRs from patch.)
patching file doc/src/sgml/func.sgml
(Stripping trailing CRs from patch.)
patching file
On 1/19/14, 12:21 AM, Pavel Stehule wrote:
I checked it and I got a small issue
bash-4.1$ patch -p1 cardinality.patch
(Stripping trailing CRs from patch.)
not sure about source of this problem.
I can't reproduce the problem. In fact, I don't see a single CR byte in
the patch file on my
2014/1/19 Marko Tiikkaja ma...@joh.to
On 1/19/14, 12:21 AM, Pavel Stehule wrote:
I checked it and I got a small issue
bash-4.1$ patch -p1 cardinality.patch
(Stripping trailing CRs from patch.)
not sure about source of this problem.
I can't reproduce the problem. In fact, I don't see
On 1/12/14, 5:53 AM, I wrote:
On 1/9/14, 2:57 PM, Dean Rasheed wrote:
How it should behave for multi-dimensional arrays is less clear, but
I'd argue that it should return the total number of elements, i.e.
cardinality('{{1,2},{3,4}}'::int[][]) = 4. That would make it
consistent with the choices
On Jan10, 2014, at 15:10 , Merlin Moncure mmonc...@gmail.com wrote:
On Fri, Jan 10, 2014 at 6:00 AM, Florian Pflug f...@phlo.org wrote:
On Jan10, 2014, at 11:00 , Merlin Moncure mmonc...@gmail.com wrote:
On Fri, Jan 10, 2014 at 3:52 AM, Marko Tiikkaja ma...@joh.to wrote:
On 1/10/14, 10:41 AM,
On 1/9/14, 2:57 PM, Dean Rasheed wrote:
Yes, this should just return the number of elements, and 0 for an empty array.
How it should behave for multi-dimensional arrays is less clear, but
I'd argue that it should return the total number of elements, i.e.
cardinality('{{1,2},{3,4}}'::int[][]) =
2014/1/12 Marko Tiikkaja ma...@joh.to
On 1/9/14, 2:57 PM, Dean Rasheed wrote:
Yes, this should just return the number of elements, and 0 for an empty
array.
How it should behave for multi-dimensional arrays is less clear, but
I'd argue that it should return the total number of elements,
On 10 January 2014 00:36, Marko Tiikkaja ma...@joh.to wrote:
On 1/10/14, 1:20 AM, Merlin Moncure wrote:
I'm piling on: it's not clear at all to me why you've special cased
this to lower_bound=1. First of all, there are other reasons to check
length than iteration.
Yes, I agree. A length
On 1/10/14, 9:04 AM, Dean Rasheed wrote:
On 10 January 2014 00:36, Marko Tiikkaja ma...@joh.to wrote:
Can you point me to some examples?
The example I see all the time is code like
if array_length(nodes, 1) 5 then
... do something ...
then you realise (or not as the case may be)
On Fri, Jan 10, 2014 at 2:04 AM, Dean Rasheed dean.a.rash...@gmail.com wrote:
On 10 January 2014 00:36, Marko Tiikkaja ma...@joh.to wrote:
On 1/10/14, 1:20 AM, Merlin Moncure wrote:
I'm piling on: it's not clear at all to me why you've special cased
this to lower_bound=1. First of all, there
On 1/10/14, 10:41 AM, Merlin Moncure wrote:
What's needed for better iteration support (IMO)
is a function that does what unnest does but returns an array on
indexes (one per dimsension) -- a generalization of the
_pg_expandarray function. Lets' say 'unnest_dims'.
So
On Fri, Jan 10, 2014 at 3:52 AM, Marko Tiikkaja ma...@joh.to wrote:
On 1/10/14, 10:41 AM, Merlin Moncure wrote:
What's needed for better iteration support (IMO)
is a function that does what unnest does but returns an array on
indexes (one per dimsension) -- a generalization of the
On Jan10, 2014, at 11:00 , Merlin Moncure mmonc...@gmail.com wrote:
On Fri, Jan 10, 2014 at 3:52 AM, Marko Tiikkaja ma...@joh.to wrote:
On 1/10/14, 10:41 AM, Merlin Moncure wrote:
What's needed for better iteration support (IMO)
is a function that does what unnest does but returns an array
On Fri, Jan 10, 2014 at 6:00 AM, Florian Pflug f...@phlo.org wrote:
On Jan10, 2014, at 11:00 , Merlin Moncure mmonc...@gmail.com wrote:
On Fri, Jan 10, 2014 at 3:52 AM, Marko Tiikkaja ma...@joh.to wrote:
On 1/10/14, 10:41 AM, Merlin Moncure wrote:
What's needed for better iteration support
On 19 December 2013 08:05, Pavel Stehule pavel.steh...@gmail.com wrote:
2013/12/19 David Fetter da...@fetter.org
On Wed, Dec 18, 2013 at 09:27:54PM +0100, Marko Tiikkaja wrote:
Hi,
Attached is a patch to add support for array_length(anyarray), which
only works for one-dimensional
On Jan9, 2014, at 14:57 , Dean Rasheed dean.a.rash...@gmail.com wrote:
On 19 December 2013 08:05, Pavel Stehule pavel.steh...@gmail.com wrote:
length should be irrelevant to fact so array starts from 1, 0 or anything
else
Yes, this should just return the number of elements, and 0 for an
On 1/9/14 5:44 PM, Florian Pflug wrote:
On Jan9, 2014, at 14:57 , Dean Rasheed dean.a.rash...@gmail.com wrote:
On 19 December 2013 08:05, Pavel Stehule pavel.steh...@gmail.com wrote:
length should be irrelevant to fact so array starts from 1, 0 or anything
else
Yes, this should just return
On 1/9/14, 11:08 AM, Marko Tiikkaja wrote:
On 1/9/14 5:44 PM, Florian Pflug wrote:
On Jan9, 2014, at 14:57 , Dean Rasheed dean.a.rash...@gmail.com wrote:
On 19 December 2013 08:05, Pavel Stehule pavel.steh...@gmail.com wrote:
length should be irrelevant to fact so array starts from 1, 0 or
On Jan9, 2014, at 23:26 , Jim Nasby j...@nasby.net wrote:
On 1/9/14, 11:08 AM, Marko Tiikkaja wrote:
On 1/9/14 5:44 PM, Florian Pflug wrote:
On Jan9, 2014, at 14:57 , Dean Rasheed dean.a.rash...@gmail.com wrote:
On 19 December 2013 08:05, Pavel Stehule pavel.steh...@gmail.com wrote:
length
On Thu, Jan 9, 2014 at 11:08 AM, Marko Tiikkaja ma...@joh.to wrote:
On 1/9/14 5:44 PM, Florian Pflug wrote:
On Jan9, 2014, at 14:57 , Dean Rasheed dean.a.rash...@gmail.com wrote:
On 19 December 2013 08:05, Pavel Stehule pavel.steh...@gmail.com wrote:
length should be irrelevant to fact so
On 1/10/14, 1:20 AM, Merlin Moncure wrote:
I'm piling on: it's not clear at all to me why you've special cased
this to lower_bound=1. First of all, there are other reasons to check
length than iteration.
Can you point me to some examples?
the server API function should implement as many
On Wed, Dec 18, 2013 at 09:27:54PM +0100, Marko Tiikkaja wrote:
Hi,
Attached is a patch to add support for array_length(anyarray), which
only works for one-dimensional arrays, returns 0 for empty arrays
and complains if the array's lower bound isn't 1. In other words,
does the right thing
2013/12/19 David Fetter da...@fetter.org
On Wed, Dec 18, 2013 at 09:27:54PM +0100, Marko Tiikkaja wrote:
Hi,
Attached is a patch to add support for array_length(anyarray), which
only works for one-dimensional arrays, returns 0 for empty arrays
and complains if the array's lower bound
Hi,
Attached is a patch to add support for array_length(anyarray), which
only works for one-dimensional arrays, returns 0 for empty arrays and
complains if the array's lower bound isn't 1. In other words, does the
right thing when used with the arrays people use 99% of the time.
I'll add
On 12/18/2013 03:27 PM, Marko Tiikkaja wrote:
Hi,
Attached is a patch to add support for array_length(anyarray), which
only works for one-dimensional arrays, returns 0 for empty arrays and
complains if the array's lower bound isn't 1. In other words, does
the right thing when used with the
On 2013-12-18 22:13, Andrew Dunstan wrote:
On 12/18/2013 03:27 PM, Marko Tiikkaja wrote:
Attached is a patch to add support for array_length(anyarray), which
only works for one-dimensional arrays, returns 0 for empty arrays and
complains if the array's lower bound isn't 1. In other words, does
On 2013-12-18 22:19, I wrote:
On 2013-12-18 22:13, Andrew Dunstan wrote:
On 12/18/2013 03:27 PM, Marko Tiikkaja wrote:
Attached is a patch to add support for array_length(anyarray), which
only works for one-dimensional arrays, returns 0 for empty arrays and
complains if the array's lower bound
On 12/18/2013 04:19 PM, Marko Tiikkaja wrote:
On 2013-12-18 22:13, Andrew Dunstan wrote:
On 12/18/2013 03:27 PM, Marko Tiikkaja wrote:
Attached is a patch to add support for array_length(anyarray), which
only works for one-dimensional arrays, returns 0 for empty arrays and
complains if the
On 2013-12-18 22:32, Andrew Dunstan wrote:
You're not really free to assume it - you'll need an exception handler
for the other-than-1 case, or your code might blow up.
This seems to be codifying a bad pattern, which should be using
array_lower() and array_upper() instead.
That's the entire
Marko Tiikkaja-4 wrote
On 2013-12-18 22:32, Andrew Dunstan wrote:
You're not really free to assume it - you'll need an exception handler
for the other-than-1 case, or your code might blow up.
This seems to be codifying a bad pattern, which should be using
array_lower() and array_upper()
On 12/19/13, 12:01 AM, David Johnston wrote:
Marko Tiikkaja-4 wrote
On 2013-12-18 22:32, Andrew Dunstan wrote:
You're not really free to assume it - you'll need an exception handler
for the other-than-1 case, or your code might blow up.
This seems to be codifying a bad pattern, which should
Robert Haas wrote:
Hmm, ISTM that cardinality() is implemented here in the manner
previously rejected for array_length()...
The objection was that basic functionality should not be implemented in
SQL. If we want to disallow all compatibility functions implemented in
SQL as well, we have
Hmm, ISTM that cardinality() is implemented here in the manner
previously rejected for array_length()...
...Robert
On Wed, Nov 12, 2008 at 8:13 AM, Peter Eisentraut [EMAIL PROTECTED] wrote:
Robert Haas wrote:
Updated version attached, this time without the compiler warning.
I have committed
Robert Haas wrote:
Updated version attached, this time without the compiler warning.
I have committed something based on this. The issue of empty arrays
will need a separate solution.
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your
On Nov 5, 2008, at 7:00 AM, Peter Eisentraut wrote:
There is a tiny problem with this implementation: It returns null
for an empty array, not zero. This is because array_lower and/or
array_upper return null for an empty array, which makes sense for
those cases. We could fix this by
Updated version attached, this time without the compiler warning.
Sorry for the sloppy work.
...Robert
Index: doc/src/sgml/array.sgml
===
RCS file: /projects/cvsroot/pgsql/doc/src/sgml/array.sgml,v
retrieving revision 1.67
diff -c
There is a tiny problem with this implementation: It returns null for an
empty array, not zero. This is because array_lower and/or array_upper
return null for an empty array, which makes sense for those cases. We
could fix this by putting a coalesce around the expression, but since
the
Hmm... the problem is that an empty array is really zero-dimensional.
So for what values of the second argument ought we to return 0?
It certainly seems inconsistent to say that array_length({}, 6) = 0
and array_length({1}, 6) is null.
Ugh. I meant rather:
It certainly seems inconsistent
Decibel! wrote:
ISTM it'd be useful to have an array_length function (since I just wrote
one for work ;), so here's a patch. Note that I don't have the docs
toolchain setup, so I wasn't able to test the doc patches.
There is a tiny problem with this implementation: It returns null for an
Hello
2008/11/5 Peter Eisentraut [EMAIL PROTECTED]:
Decibel! wrote:
ISTM it'd be useful to have an array_length function (since I just wrote
one for work ;), so here's a patch. Note that I don't have the docs
toolchain setup, so I wasn't able to test the doc patches.
There is a tiny
Pavel Stehule wrote:
Hello
2008/11/5 Peter Eisentraut [EMAIL PROTECTED]:
Decibel! wrote:
ISTM it'd be useful to have an array_length function (since I just wrote
one for work ;), so here's a patch. Note that I don't have the docs
toolchain setup, so I wasn't able to test the doc patches.
2008/11/5 Peter Eisentraut [EMAIL PROTECTED]:
Pavel Stehule wrote:
Hello
2008/11/5 Peter Eisentraut [EMAIL PROTECTED]:
Decibel! wrote:
ISTM it'd be useful to have an array_length function (since I just wrote
one for work ;), so here's a patch. Note that I don't have the docs
toolchain
Peter Eisentraut [EMAIL PROTECTED] writes:
There is a tiny problem with this implementation: It returns null for an
empty array, not zero. This is because array_lower and/or array_upper
return null for an empty array, which makes sense for those cases. We
could fix this by putting a
ISTM it'd be useful to have an array_length function (since I just
wrote one for work ;), so here's a patch. Note that I don't have the
docs toolchain setup, so I wasn't able to test the doc patches.
array_length.patch
Description: Binary data
--
Decibel!, aka Jim C. Nasby, Database
53 matches
Mail list logo