Change type of pg_statistic_ext.stxstattarget
authorPeter Eisentraut <peter@eisentraut.org>
Mon, 3 Jul 2023 05:09:22 +0000 (07:09 +0200)
committerPeter Eisentraut <peter@eisentraut.org>
Mon, 3 Jul 2023 05:18:57 +0000 (07:18 +0200)
Change from int32 to int16, to match attstattarget (changed in
90189eefc1).

Reviewed-by: Tomas Vondra <tomas.vondra@enterprisedb.com>
Discussion: https://www.postgresql.org/message-id/flat/d6069765-5971-04d3-c10d-e4f7b2e9c459%40eisentraut.org

doc/src/sgml/catalogs.sgml
src/backend/commands/statscmds.c
src/include/catalog/catversion.h
src/include/catalog/pg_statistic_ext.h

index ed32ca03495f412e19f6bfefac3efe6587e008c9..852cb30ae11ed154ce4149408f9cc4c793aae9bf 100644 (file)
@@ -7622,7 +7622,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
 
      <row>
       <entry role="catalog_table_entry"><para role="column_definition">
-       <structfield>stxstattarget</structfield> <type>int4</type>
+       <structfield>stxstattarget</structfield> <type>int2</type>
       </para>
       <para>
        <structfield>stxstattarget</structfield> controls the level of detail
index 26ebd0819d625859f14ade344598c118916355c7..c2dab20bdc496ba8dc71514976b8d47818e47a4d 100644 (file)
@@ -498,7 +498,7 @@ CreateStatistics(CreateStatsStmt *stmt)
        values[Anum_pg_statistic_ext_stxrelid - 1] = ObjectIdGetDatum(relid);
        values[Anum_pg_statistic_ext_stxname - 1] = NameGetDatum(&stxname);
        values[Anum_pg_statistic_ext_stxnamespace - 1] = ObjectIdGetDatum(namespaceId);
-       values[Anum_pg_statistic_ext_stxstattarget - 1] = Int32GetDatum(-1);
+       values[Anum_pg_statistic_ext_stxstattarget - 1] = Int16GetDatum(-1);
        values[Anum_pg_statistic_ext_stxowner - 1] = ObjectIdGetDatum(stxowner);
        values[Anum_pg_statistic_ext_stxkeys - 1] = PointerGetDatum(stxkeys);
        values[Anum_pg_statistic_ext_stxkind - 1] = PointerGetDatum(stxkind);
@@ -676,7 +676,7 @@ AlterStatistics(AlterStatsStmt *stmt)
 
        /* replace the stxstattarget column */
        repl_repl[Anum_pg_statistic_ext_stxstattarget - 1] = true;
-       repl_val[Anum_pg_statistic_ext_stxstattarget - 1] = Int32GetDatum(newtarget);
+       repl_val[Anum_pg_statistic_ext_stxstattarget - 1] = Int16GetDatum(newtarget);
 
        newtup = heap_modify_tuple(oldtup, RelationGetDescr(rel),
                                                           repl_val, repl_null, repl_repl);
index fe70d8396d6c54e346311806ea78f68522c3d264..b0c557a828d9cb973e6d0dfe4b1aeaef9731c7fd 100644 (file)
@@ -57,6 +57,6 @@
  */
 
 /*                                                     yyyymmddN */
-#define CATALOG_VERSION_NO     202306141
+#define CATALOG_VERSION_NO     202307031
 
 #endif
index 53eec9025a52eaaf59c9560f048011d7cac60f5d..1e64aa8f163be8d7312ef9c6e1769793feaa3e2b 100644 (file)
@@ -43,7 +43,7 @@ CATALOG(pg_statistic_ext,3381,StatisticExtRelationId)
                                                                                                                 * object's namespace */
 
        Oid                     stxowner BKI_LOOKUP(pg_authid); /* statistics object's owner */
-       int32           stxstattarget BKI_DEFAULT(-1);  /* statistics target */
+       int16           stxstattarget BKI_DEFAULT(-1);  /* statistics target */
 
        /*
         * variable-length fields start here, but we allow direct access to