Обсуждение: lbound1 default in buildint2vector/buildoidvector
Hello, I noticed buildint2vector / buildoidvector assigns lbound1=0 as default value, but array type shall have lbound1=1 in the default. Is there some reasons for the difference? When I made a simple C-function that returns result of int2vector which carries attribute numbers of the argument. postgres=# select attnums_of('t0','{aid,cid,bid}'); attnums_of --------------- [0:2]={3,5,4} (1 row) Once it assigns lbound1=1 manually, postgres=# select attnums_of('t0','{aid,cid,bid}'); attnums_of ------------ {3,5,4} (1 row) Maybe, the later one is natural. Of course, these APIs are mostly internal, so lbound1 setting is not significant so much. Thanks, -- HeteroDB, Inc / The PG-Strom Project KaiGai Kohei <kaigai@heterodb.com>
Kohei KaiGai <kaigai@heterodb.com> writes: > I noticed buildint2vector / buildoidvector assigns lbound1=0 as default > value, but array type shall have lbound1=1 in the default. > Is there some reasons for the difference? Backwards compatibility. regards, tom lane
2018年11月15日(木) 12:41 Tom Lane <tgl@sss.pgh.pa.us>: > > Kohei KaiGai <kaigai@heterodb.com> writes: > > I noticed buildint2vector / buildoidvector assigns lbound1=0 as default > > value, but array type shall have lbound1=1 in the default. > > Is there some reasons for the difference? > > Backwards compatibility. > Ah, yes, I got the point. -- HeteroDB, Inc / The PG-Strom Project KaiGai Kohei <kaigai@heterodb.com>