Skip site navigation (1) Skip section navigation (2)

Re: is array bug? (array[][])[] = NULL

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Pavel Stehule <stehule(at)kix(dot)fsv(dot)cvut(dot)cz>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: is array bug? (array[][])[] = NULL
Date: 2004-06-04 14:46:40
Message-ID: 27308.1086360400@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
Pavel Stehule <stehule(at)kix(dot)fsv(dot)cvut(dot)cz> writes:
> I expect v1 = [1,2], but v1 is null.
> What is wrong?

Postgres arrays don't work that way; you're assuming the semantics are
like C which they aren't.

You could get an approximation to what you want with array slicing, viz
	v2[1:1][1:2]
but note that this doesn't decrease the dimensionality of the result.

			regards, tom lane

In response to

pgsql-bugs by date

Next:From: Tom LaneDate: 2004-06-04 15:15:31
Subject: Re: build postgresql-7.4.2 fails: FATAL: semctl(35, 16, SETVAL, 536) failed: Inv,alid argument
Previous:From: Donald FraserDate: 2004-06-04 14:05:26
Subject: Cached PL/PGSQL query plan failure

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group