Curiosity with catalog table array attribute index dimensions

Started by Erik Jonesabout 18 years ago3 messagesgeneral
Jump to latest
#1Erik Jones
erik@myemma.com

So, I noticed today that pg_index.indkey index values start at 0
instead of 1 as I'd expected. Are there other cases of this?
Shouldn't that be documented somewhere?

Erik Jones

DBA | Emma®
erik@myemma.com
800.595.4401 or 615.292.5888
615.292.0777 (fax)

Emma helps organizations everywhere communicate & market in style.
Visit us online at http://www.myemma.com

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Erik Jones (#1)
Re: Curiosity with catalog table array attribute index dimensions

Erik Jones <erik@myemma.com> writes:

So, I noticed today that pg_index.indkey index values start at 0
instead of 1 as I'd expected. Are there other cases of this?
Shouldn't that be documented somewhere?

Well, the CREATE TYPE manual page has

For historical reasons (i.e., this is clearly wrong but it's far too
late to change it), subscripting of fixed-length array types starts from
zero, rather than from one as for variable-length arrays.

oidvector and int2vector aren't fixed-length anymore, but they maintain
their old behavior in this respect for backward compatibility.

regards, tom lane

#3Erik Jones
erik@myemma.com
In reply to: Tom Lane (#2)
Re: Curiosity with catalog table array attribute index dimensions

On Apr 16, 2008, at 4:26 PM, Tom Lane wrote:

Erik Jones <erik@myemma.com> writes:

So, I noticed today that pg_index.indkey index values start at 0
instead of 1 as I'd expected. Are there other cases of this?
Shouldn't that be documented somewhere?

Well, the CREATE TYPE manual page has

For historical reasons (i.e., this is clearly wrong but it's far
too
late to change it), subscripting of fixed-length array types
starts from
zero, rather than from one as for variable-length arrays.

oidvector and int2vector aren't fixed-length anymore, but they
maintain
their old behavior in this respect for backward compatibility.

Ah, thanks, at least now I know what to look for instead of using
trial and error.

Erik Jones

DBA | Emma®
erik@myemma.com
800.595.4401 or 615.292.5888
615.292.0777 (fax)

Emma helps organizations everywhere communicate & market in style.
Visit us online at http://www.myemma.com