Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc1da0ac

Browse files
committed
Test ALIGNOF_DOUBLE==4 compatibility under ALIGNOF_DOUBLE==8.
Today's test case detected alignment problems only when executing onAIX. This change lets popular platforms detect the same problems.Reviewed by Masahiko Sawada.Discussion:https://postgr.es/m/20220415072601.GG862547@rfd.leadboat.com
1 parenta66e722 commitc1da0ac

File tree

5 files changed

+16
-20
lines changed

5 files changed

+16
-20
lines changed

‎src/test/regress/expected/sanity_check.out

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,18 @@ WITH check_columns AS (
3939
SELECT t.oid
4040
FROM pg_type t JOIN pg_attribute pa ON t.oid = pa.atttypid
4141
WHERE pa.attrelid = a.attrelid AND
42-
pa.attnum > 0 AND pa.attnum <= a.attnum
42+
pa.attnum > 0 AND pa.attnum < a.attnum
4343
ORDER BY pa.attnum) AS coltypes
4444
FROM pg_attribute a JOIN pg_class c ON c.oid = attrelid
4545
JOIN pg_namespace n ON c.relnamespace = n.oid
4646
WHERE attalign = 'd' AND relkind = 'r' AND
4747
attnotnull AND attlen <> -1 AND n.nspname = 'pg_catalog'
4848
)
49-
SELECT relname, attname, coltypes,get_column_offset(coltypes)
49+
SELECT relname, attname, coltypes,get_columns_length(coltypes)
5050
FROM check_columns
51-
WHEREget_column_offset(coltypes) % 8 != 0 OR
51+
WHEREget_columns_length(coltypes) % 8 != 0 OR
5252
'name'::regtype::oid = ANY(coltypes);
53-
relname | attname | coltypes |get_column_offset
54-
---------+---------+----------+-------------------
53+
relname | attname | coltypes |get_columns_length
54+
---------+---------+----------+--------------------
5555
(0 rows)
5656

‎src/test/regress/expected/test_setup.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ CREATE FUNCTION ttdummy ()
206206
RETURNS trigger
207207
AS :'regresslib'
208208
LANGUAGE C;
209-
CREATE FUNCTIONget_column_offset(oid[])
209+
CREATE FUNCTIONget_columns_length(oid[])
210210
RETURNS int
211211
AS :'regresslib'
212212
LANGUAGE C STRICT STABLE PARALLEL SAFE;

‎src/test/regress/regress.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,12 +1219,12 @@ binary_coercible(PG_FUNCTION_ARGS)
12191219
}
12201220

12211221
/*
1222-
* Return thecolumn offsetof thelast data inthe given array of
1223-
* data types. The input data types must be fixed-length data types.
1222+
* Return thelengthof theportion of a tuple consisting ofthe given array
1223+
*ofdata types. The input data types must be fixed-length data types.
12241224
*/
1225-
PG_FUNCTION_INFO_V1(get_column_offset);
1225+
PG_FUNCTION_INFO_V1(get_columns_length);
12261226
Datum
1227-
get_column_offset(PG_FUNCTION_ARGS)
1227+
get_columns_length(PG_FUNCTION_ARGS)
12281228
{
12291229
ArrayType*ta=PG_GETARG_ARRAYTYPE_P(0);
12301230
Oid*type_oids;
@@ -1249,14 +1249,10 @@ get_column_offset(PG_FUNCTION_ARGS)
12491249
get_typlenbyvalalign(typeoid,&typlen,&typbyval,&typalign);
12501250

12511251
/* the data type must be fixed-length */
1252-
if (!(typbyval|| (typlen>0)))
1252+
if (typlen<0)
12531253
elog(ERROR,"type %u is not fixed-length data type",typeoid);
12541254

1255-
column_offset=att_align_nominal(column_offset,typalign);
1256-
1257-
/* not include the last type size */
1258-
if (i!= (ntypes-1))
1259-
column_offset+=typlen;
1255+
column_offset=att_align_nominal(column_offset+typlen,typalign);
12601256
}
12611257

12621258
PG_RETURN_INT32(column_offset);

‎src/test/regress/sql/sanity_check.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ WITH check_columns AS (
3434
SELECTt.oid
3535
FROM pg_type tJOIN pg_attribute paONt.oid=pa.atttypid
3636
WHEREpa.attrelid=a.attrelidAND
37-
pa.attnum>0ANDpa.attnum<=a.attnum
37+
pa.attnum>0ANDpa.attnum<a.attnum
3838
ORDER BYpa.attnum)AS coltypes
3939
FROM pg_attribute aJOIN pg_class cONc.oid= attrelid
4040
JOIN pg_namespace nONc.relnamespace=n.oid
4141
WHERE attalign='d'AND relkind='r'AND
4242
attnotnullAND attlen<>-1ANDn.nspname='pg_catalog'
4343
)
44-
SELECT relname, attname, coltypes,get_column_offset(coltypes)
44+
SELECT relname, attname, coltypes,get_columns_length(coltypes)
4545
FROM check_columns
46-
WHEREget_column_offset(coltypes) %8!=0OR
46+
WHEREget_columns_length(coltypes) %8!=0OR
4747
'name'::regtype::oid= ANY(coltypes);

‎src/test/regress/sql/test_setup.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ CREATE FUNCTION ttdummy ()
253253
AS :'regresslib'
254254
LANGUAGE C;
255255

256-
CREATEFUNCTIONget_column_offset(oid[])
256+
CREATEFUNCTIONget_columns_length(oid[])
257257
RETURNSint
258258
AS :'regresslib'
259259
LANGUAGE C STRICT STABLE PARALLEL SAFE;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp