]> granicus.if.org Git - postgresql/commitdiff
Drop the vestigial "smgr" type.
authorThomas Munro <tmunro@postgresql.org>
Thu, 7 Mar 2019 02:43:37 +0000 (15:43 +1300)
committerThomas Munro <tmunro@postgresql.org>
Thu, 7 Mar 2019 02:44:04 +0000 (15:44 +1300)
Before commit 3fa2bb31 this type appeared in the catalogs to
select which of several block storage mechanisms each relation
used.

New features under development propose to revive the concept of
different block storage managers for new kinds of data accessed
via bufmgr.c, but don't need to put references to them in the
catalogs.  So, avoid useless maintenance work on this type by
dropping it.  Update some regression tests that were referencing
it where any type would do.

Discussion: https://postgr.es/m/CA%2BhUKG%2BDE0mmiBZMtZyvwWtgv1sZCniSVhXYsXkvJ_Wo%2B83vvw%40mail.gmail.com

src/backend/storage/smgr/Makefile
src/backend/storage/smgr/README
src/backend/storage/smgr/smgrtype.c [deleted file]
src/include/catalog/catversion.h
src/include/catalog/pg_proc.dat
src/include/catalog/pg_type.dat
src/test/regress/expected/alter_table.out
src/test/regress/expected/type_sanity.out
src/test/regress/sql/alter_table.sql

index 2b95cb0df1602e871b68fb49f831174c23929e23..e486b7c0d1c2c97ecda21c02f96533397d4f2c97 100644 (file)
@@ -12,6 +12,6 @@ subdir = src/backend/storage/smgr
 top_builddir = ../../../..
 include $(top_builddir)/src/Makefile.global
 
-OBJS = md.o smgr.o smgrtype.o
+OBJS = md.o smgr.o
 
 include $(top_srcdir)/src/backend/common.mk
index 37ed40b6450852f6dc308390a4a123db87d96749..e1cfc6cd2645046d92af2fa9f3238f9320024bdf 100644 (file)
@@ -31,12 +31,6 @@ The files in this directory, and their contents, are
     md.c       The "magnetic disk" storage manager, which is really just
                an interface to the kernel's filesystem operations.
 
-    smgrtype.c Storage manager type -- maps string names to storage manager
-               IDs and provides simple comparison operators.  This is the
-               regproc support for type "smgr" in the system catalogs.
-               (This is vestigial since no columns of type smgr exist
-               in the catalogs anymore.)
-
 Note that md.c in turn relies on src/backend/storage/file/fd.c.
 
 
diff --git a/src/backend/storage/smgr/smgrtype.c b/src/backend/storage/smgr/smgrtype.c
deleted file mode 100644 (file)
index cf12094..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * smgrtype.c
- *       storage manager type
- *
- * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
- * Portions Copyright (c) 1994, Regents of the University of California
- *
- *
- * IDENTIFICATION
- *       src/backend/storage/smgr/smgrtype.c
- *
- *-------------------------------------------------------------------------
- */
-#include "postgres.h"
-
-#include "storage/smgr.h"
-#include "utils/builtins.h"
-
-
-typedef struct smgrid
-{
-       const char *smgr_name;
-} smgrid;
-
-/*
- *     StorageManager[] -- List of defined storage managers.
- */
-static const smgrid StorageManager[] = {
-       {"magnetic disk"}
-};
-
-static const int NStorageManagers = lengthof(StorageManager);
-
-
-Datum
-smgrin(PG_FUNCTION_ARGS)
-{
-       char       *s = PG_GETARG_CSTRING(0);
-       int16           i;
-
-       for (i = 0; i < NStorageManagers; i++)
-       {
-               if (strcmp(s, StorageManager[i].smgr_name) == 0)
-                       PG_RETURN_INT16(i);
-       }
-       elog(ERROR, "unrecognized storage manager name \"%s\"", s);
-       PG_RETURN_INT16(0);
-}
-
-Datum
-smgrout(PG_FUNCTION_ARGS)
-{
-       int16           i = PG_GETARG_INT16(0);
-       char       *s;
-
-       if (i >= NStorageManagers || i < 0)
-               elog(ERROR, "invalid storage manager ID: %d", i);
-
-       s = pstrdup(StorageManager[i].smgr_name);
-       PG_RETURN_CSTRING(s);
-}
-
-Datum
-smgreq(PG_FUNCTION_ARGS)
-{
-       int16           a = PG_GETARG_INT16(0);
-       int16           b = PG_GETARG_INT16(1);
-
-       PG_RETURN_BOOL(a == b);
-}
-
-Datum
-smgrne(PG_FUNCTION_ARGS)
-{
-       int16           a = PG_GETARG_INT16(0);
-       int16           b = PG_GETARG_INT16(1);
-
-       PG_RETURN_BOOL(a != b);
-}
index 523958733d58e974921acaf326683a21367aead8..ad8bde6ae3afb5b35809a00e4e9552f30ed89313 100644 (file)
@@ -53,6 +53,6 @@
  */
 
 /*                                                     yyyymmddN */
-#define CATALOG_VERSION_NO     201903062
+#define CATALOG_VERSION_NO     201903063
 
 #endif
index bce909b05ac2d8df3b1ca1022e29ed0a2dc64758..2e9d6cf2f5e0f3d7600996a0aca4140a699de7d7 100644 (file)
   proargtypes => 'internal oid internal int2 internal',
   prosrc => 'arraycontjoinsel' },
 
-{ oid => '760', descr => 'I/O',
-  proname => 'smgrin', provolatile => 's', prorettype => 'smgr',
-  proargtypes => 'cstring', prosrc => 'smgrin' },
-{ oid => '761', descr => 'I/O',
-  proname => 'smgrout', provolatile => 's', prorettype => 'cstring',
-  proargtypes => 'smgr', prosrc => 'smgrout' },
-{ oid => '762', descr => 'storage manager',
-  proname => 'smgreq', prorettype => 'bool', proargtypes => 'smgr smgr',
-  prosrc => 'smgreq' },
-{ oid => '763', descr => 'storage manager',
-  proname => 'smgrne', prorettype => 'bool', proargtypes => 'smgr smgr',
-  prosrc => 'smgrne' },
-
 { oid => '764', descr => 'large object import',
   proname => 'lo_import', provolatile => 'v', proparallel => 'u',
   prorettype => 'oid', proargtypes => 'text', prosrc => 'be_lo_import' },
index 4497ff6a2c591e6f3244a9cbefe042633e453b35..d1295835e2d7e026a1ea3bd8d44e2a4a5a5d4590 100644 (file)
   typoutput => 'pg_ddl_command_out', typreceive => 'pg_ddl_command_recv',
   typsend => 'pg_ddl_command_send', typalign => 'ALIGNOF_POINTER' },
 
-# OIDS 200 - 299
-
-{ oid => '210', descr => 'storage manager',
-  typname => 'smgr', typlen => '2', typbyval => 't', typcategory => 'U',
-  typinput => 'smgrin', typoutput => 'smgrout', typreceive => '-',
-  typsend => '-', typalign => 's' },
-
 # OIDS 600 - 699
 
 { oid => '600', array_type_oid => '1017',
index 4db792cf2ffe47960f6ba6f16ff0e6279e08357e..fd14c4b4f2a2f3ab0044a3f4ac6e2c2da0468f36 100644 (file)
@@ -29,7 +29,7 @@ ALTER TABLE attmp ADD COLUMN l tid;
 ALTER TABLE attmp ADD COLUMN m xid;
 ALTER TABLE attmp ADD COLUMN n oidvector;
 --ALTER TABLE attmp ADD COLUMN o lock;
-ALTER TABLE attmp ADD COLUMN p smgr;
+ALTER TABLE attmp ADD COLUMN p boolean;
 ALTER TABLE attmp ADD COLUMN q point;
 ALTER TABLE attmp ADD COLUMN r lseg;
 ALTER TABLE attmp ADD COLUMN s path;
@@ -44,13 +44,13 @@ INSERT INTO attmp (a, b, c, d, e, f, g,    i,    k, l, m, n, p, q, r, s, t,
    VALUES (4, 'name', 'text', 4.1, 4.1, 2, '(4.1,4.1,3.1,3.1)',
        'c',
        314159, '(1,1)', '512',
-       '1 2 3 4 5 6 7 8', 'magnetic disk', '(1.1,1.1)', '(4.1,4.1,3.1,3.1)',
+       '1 2 3 4 5 6 7 8', true, '(1.1,1.1)', '(4.1,4.1,3.1,3.1)',
        '(0,2,4.1,4.1,3.1,3.1)', '(4.1,4.1,3.1,3.1)',
        'epoch', '01:00:10', '{1.0,2.0,3.0,4.0}', '{1.0,2.0,3.0,4.0}', '{1,2,3,4}');
 SELECT * FROM attmp;
- initial | a |  b   |  c   |  d  |  e  | f |           g           | i |   k    |   l   |  m  |        n        |       p       |     q     |           r           |              s              |          t          |            v             |        w         |     x     |     y     |     z     
----------+---+------+------+-----+-----+---+-----------------------+---+--------+-------+-----+-----------------+---------------+-----------+-----------------------+-----------------------------+---------------------+--------------------------+------------------+-----------+-----------+-----------
-         | 4 | name | text | 4.1 | 4.1 | 2 | ((4.1,4.1),(3.1,3.1)) | c | 314159 | (1,1) | 512 | 1 2 3 4 5 6 7 8 | magnetic disk | (1.1,1.1) | [(4.1,4.1),(3.1,3.1)] | ((0,2),(4.1,4.1),(3.1,3.1)) | (4.1,4.1),(3.1,3.1) | Thu Jan 01 00:00:00 1970 | @ 1 hour 10 secs | {1,2,3,4} | {1,2,3,4} | {1,2,3,4}
+ initial | a |  b   |  c   |  d  |  e  | f |           g           | i |   k    |   l   |  m  |        n        | p |     q     |           r           |              s              |          t          |            v             |        w         |     x     |     y     |     z     
+---------+---+------+------+-----+-----+---+-----------------------+---+--------+-------+-----+-----------------+---+-----------+-----------------------+-----------------------------+---------------------+--------------------------+------------------+-----------+-----------+-----------
+         | 4 | name | text | 4.1 | 4.1 | 2 | ((4.1,4.1),(3.1,3.1)) | c | 314159 | (1,1) | 512 | 1 2 3 4 5 6 7 8 | t | (1.1,1.1) | [(4.1,4.1),(3.1,3.1)] | ((0,2),(4.1,4.1),(3.1,3.1)) | (4.1,4.1),(3.1,3.1) | Thu Jan 01 00:00:00 1970 | @ 1 hour 10 secs | {1,2,3,4} | {1,2,3,4} | {1,2,3,4}
 (1 row)
 
 DROP TABLE attmp;
@@ -71,7 +71,7 @@ ALTER TABLE attmp ADD COLUMN l tid;
 ALTER TABLE attmp ADD COLUMN m xid;
 ALTER TABLE attmp ADD COLUMN n oidvector;
 --ALTER TABLE attmp ADD COLUMN o lock;
-ALTER TABLE attmp ADD COLUMN p smgr;
+ALTER TABLE attmp ADD COLUMN p boolean;
 ALTER TABLE attmp ADD COLUMN q point;
 ALTER TABLE attmp ADD COLUMN r lseg;
 ALTER TABLE attmp ADD COLUMN s path;
@@ -86,13 +86,13 @@ INSERT INTO attmp (a, b, c, d, e, f, g,    i,   k, l, m, n, p, q, r, s, t,
    VALUES (4, 'name', 'text', 4.1, 4.1, 2, '(4.1,4.1,3.1,3.1)',
         'c',
        314159, '(1,1)', '512',
-       '1 2 3 4 5 6 7 8', 'magnetic disk', '(1.1,1.1)', '(4.1,4.1,3.1,3.1)',
+       '1 2 3 4 5 6 7 8', true, '(1.1,1.1)', '(4.1,4.1,3.1,3.1)',
        '(0,2,4.1,4.1,3.1,3.1)', '(4.1,4.1,3.1,3.1)',
        'epoch', '01:00:10', '{1.0,2.0,3.0,4.0}', '{1.0,2.0,3.0,4.0}', '{1,2,3,4}');
 SELECT * FROM attmp;
- initial | a |  b   |  c   |  d  |  e  | f |           g           | i |   k    |   l   |  m  |        n        |       p       |     q     |           r           |              s              |          t          |            v             |        w         |     x     |     y     |     z     
----------+---+------+------+-----+-----+---+-----------------------+---+--------+-------+-----+-----------------+---------------+-----------+-----------------------+-----------------------------+---------------------+--------------------------+------------------+-----------+-----------+-----------
-         | 4 | name | text | 4.1 | 4.1 | 2 | ((4.1,4.1),(3.1,3.1)) | c | 314159 | (1,1) | 512 | 1 2 3 4 5 6 7 8 | magnetic disk | (1.1,1.1) | [(4.1,4.1),(3.1,3.1)] | ((0,2),(4.1,4.1),(3.1,3.1)) | (4.1,4.1),(3.1,3.1) | Thu Jan 01 00:00:00 1970 | @ 1 hour 10 secs | {1,2,3,4} | {1,2,3,4} | {1,2,3,4}
+ initial | a |  b   |  c   |  d  |  e  | f |           g           | i |   k    |   l   |  m  |        n        | p |     q     |           r           |              s              |          t          |            v             |        w         |     x     |     y     |     z     
+---------+---+------+------+-----+-----+---+-----------------------+---+--------+-------+-----+-----------------+---+-----------+-----------------------+-----------------------------+---------------------+--------------------------+------------------+-----------+-----------+-----------
+         | 4 | name | text | 4.1 | 4.1 | 2 | ((4.1,4.1),(3.1,3.1)) | c | 314159 | (1,1) | 512 | 1 2 3 4 5 6 7 8 | t | (1.1,1.1) | [(4.1,4.1),(3.1,3.1)] | ((0,2),(4.1,4.1),(3.1,3.1)) | (4.1,4.1),(3.1,3.1) | Thu Jan 01 00:00:00 1970 | @ 1 hour 10 secs | {1,2,3,4} | {1,2,3,4} | {1,2,3,4}
 (1 row)
 
 CREATE INDEX attmp_idx ON attmp (a, (d + e), b);
index 91f17013d644bd7b7e7a261566dff35040f5867f..6d19c230f20c4f1215385bd9cfa933591ea91e9d 100644 (file)
@@ -72,8 +72,7 @@ WHERE p1.typtype not in ('c','d','p') AND p1.typname NOT LIKE E'\\_%'
   194 | pg_node_tree
  3361 | pg_ndistinct
  3402 | pg_dependencies
-  210 | smgr
-(4 rows)
+(3 rows)
 
 -- Make sure typarray points to a varlena array type of our own base
 SELECT p1.oid, p1.typname as basetype, p2.typname as arraytype,
index d80643037d3b855b96a0365e345ae5ed152717d0..298bde179b60623c5690a11921b690ae8d077ac3 100644 (file)
@@ -46,7 +46,7 @@ ALTER TABLE attmp ADD COLUMN m xid;
 ALTER TABLE attmp ADD COLUMN n oidvector;
 
 --ALTER TABLE attmp ADD COLUMN o lock;
-ALTER TABLE attmp ADD COLUMN p smgr;
+ALTER TABLE attmp ADD COLUMN p boolean;
 
 ALTER TABLE attmp ADD COLUMN q point;
 
@@ -71,7 +71,7 @@ INSERT INTO attmp (a, b, c, d, e, f, g,    i,    k, l, m, n, p, q, r, s, t,
    VALUES (4, 'name', 'text', 4.1, 4.1, 2, '(4.1,4.1,3.1,3.1)',
        'c',
        314159, '(1,1)', '512',
-       '1 2 3 4 5 6 7 8', 'magnetic disk', '(1.1,1.1)', '(4.1,4.1,3.1,3.1)',
+       '1 2 3 4 5 6 7 8', true, '(1.1,1.1)', '(4.1,4.1,3.1,3.1)',
        '(0,2,4.1,4.1,3.1,3.1)', '(4.1,4.1,3.1,3.1)',
        'epoch', '01:00:10', '{1.0,2.0,3.0,4.0}', '{1.0,2.0,3.0,4.0}', '{1,2,3,4}');
 
@@ -109,7 +109,7 @@ ALTER TABLE attmp ADD COLUMN m xid;
 ALTER TABLE attmp ADD COLUMN n oidvector;
 
 --ALTER TABLE attmp ADD COLUMN o lock;
-ALTER TABLE attmp ADD COLUMN p smgr;
+ALTER TABLE attmp ADD COLUMN p boolean;
 
 ALTER TABLE attmp ADD COLUMN q point;
 
@@ -134,7 +134,7 @@ INSERT INTO attmp (a, b, c, d, e, f, g,    i,   k, l, m, n, p, q, r, s, t,
    VALUES (4, 'name', 'text', 4.1, 4.1, 2, '(4.1,4.1,3.1,3.1)',
         'c',
        314159, '(1,1)', '512',
-       '1 2 3 4 5 6 7 8', 'magnetic disk', '(1.1,1.1)', '(4.1,4.1,3.1,3.1)',
+       '1 2 3 4 5 6 7 8', true, '(1.1,1.1)', '(4.1,4.1,3.1,3.1)',
        '(0,2,4.1,4.1,3.1,3.1)', '(4.1,4.1,3.1,3.1)',
        'epoch', '01:00:10', '{1.0,2.0,3.0,4.0}', '{1.0,2.0,3.0,4.0}', '{1,2,3,4}');