E.63. 版本 1.01

发布日期: 1996-02-23

E.63.1. 从 v1.0 迁移到 v1.01

1996-02-23

下面信息是给那些希望将数据库从 postgres95 1.0 向 postgres95 1.01 迁移的用户的一些有用信息.

如果你是刚刚安装完成 postgres95 1.01 并且没有需要迁移的旧数据库, 那么你不需要阅读下面部分.

如果要把postgres95 版本 1.0 的数据库向 postgres95 版本 1.01 迁移, 需要进行下面的步骤:

  1. 把文件 src/Makefile.global 里的变量 NAMEDATALEN 定义为16, OIDNAMELEN 定义为 20.

  2. 决定自己是否需要以主机为基础的认证(HBA).

    1. 如果你需要这么做, 你必须在顶级数据目录(通常是你的环境变量$PGDATA的值)里创建一个名为 "pg_hba" 的文件.我们在例子语法里用 src/libpq/pg_hba 代表.

    2. 如果你不需要这样以主机为基础的认证, 你可以把 src/Makefile.global 里的下面这行注释掉

              HBA = 1

      要注意缺省时以主机为基础的认证(HBA)是打开的, 而且如果你不做上面所说的步骤A或B中的其 中一步,其他主机上(out-of-the-box)的1.01版本将不允许你与1.0的数据库联接.

  3. 编译和安装 1.01,但是不要执行 initdb 步骤.

  4. 在进行下一步之前,宕掉1.0的postmaster进程,然后备份你现有的 $PGDATA 目录.

  5. 把你的 PGDATA 环境变量设置为你的 1.0 的库(的位置), 但是把路径设置成1.01的可执行文件路径.

  6. 把文件 $PGDATA/PG_VERSION 从5.0修改成5.1

  7. 运行新的1.01的postmaster.

  8. 把1.01的新的内建的函数和操作符追加到1.0的数据库中去. 这一步是通过在你的1.0的库上运行1.01的服务 器,并且对之运行下面的查询来实现的. 假如我们把下面查询拷贝到一个文件 1.0_to_1.01.sql 里去,那么我 们可以通过psql很容易完整升级工作.假设你的1.0数据库名为"testdb":

            % psql testdb -f 1.0_to_1.01.sql

    然后执行下面命令(可以从下面剪切和拷贝):

    -- add builtin functions that are new to 1.01
    
    create function int4eqoid (int4, oid) returns bool as 'foo'
    language 'internal';
    create function oideqint4 (oid, int4) returns bool as 'foo'
    language 'internal';
    create function char2icregexeq (char2, text) returns bool as 'foo'
    language 'internal';
    create function char2icregexne (char2, text) returns bool as 'foo'
    language 'internal';
    create function char4icregexeq (char4, text) returns bool as 'foo'
    language 'internal';
    create function char4icregexne (char4, text) returns bool as 'foo'
    language 'internal';
    create function char8icregexeq (char8, text) returns bool as 'foo'
    language 'internal';
    create function char8icregexne (char8, text) returns bool as 'foo'
    language 'internal';
    create function char16icregexeq (char16, text) returns bool as 'foo'
    language 'internal';
    create function char16icregexne (char16, text) returns bool as 'foo'
    language 'internal';
    create function texticregexeq (text, text) returns bool as 'foo'
    language 'internal';
    create function texticregexne (text, text) returns bool as 'foo'
    language 'internal';
    
    -- add builtin functions that are new to 1.01
    
    create operator = (leftarg = int4, rightarg = oid, procedure = int4eqoid);
    create operator = (leftarg = oid, rightarg = int4, procedure = oideqint4);
    create operator ~* (leftarg = char2, rightarg = text, procedure = char2icregexeq);
    create operator !~* (leftarg = char2, rightarg = text, procedure = char2icregexne);
    create operator ~* (leftarg = char4, rightarg = text, procedure = char4icregexeq);
    create operator !~* (leftarg = char4, rightarg = text, procedure = char4icregexne);
    create operator ~* (leftarg = char8, rightarg = text, procedure = char8icregexeq);
    create operator !~* (leftarg = char8, rightarg = text, procedure = char8icregexne);
    create operator ~* (leftarg = char16, rightarg = text, procedure = char16icregexeq);
    create operator !~* (leftarg = char16, rightarg = text, procedure = char16icregexne);
    create operator ~* (leftarg = text, rightarg = text, procedure = texticregexeq);
    create operator !~* (leftarg = text, rightarg = text, procedure = texticregexne);

E.63.2. 修改列表

不兼容性:
 * 1.01 is backwards compatible with 1.0 database provided the user
   follow the steps outlined in the MIGRATION_from_1.0_to_1.01 file.
   If those steps are not taken, 1.01 is not compatible with 1.0 database.

增强:
 * added PQdisplayTuples() to libpq and changed monitor and psql to use it
 * added NeXT port (requires SysVIPC implementation)
 * added CAST .. AS ... syntax
 * added ASC and DESC keywords
 * added 'internal' as a possible language for CREATE FUNCTION
   internal functions are C functions which have been statically linked
   into the postgres backend.
 * a new type "name" has been added for system identifiers (table names,
   attribute names, etc.)  This replaces the old char16 type.   The
   of name is set by the NAMEDATALEN #define in src/Makefile.global
 * a readable reference manual that describes the query language.
 * added host-based access control.  A configuration file ($PGDATA/pg_hba)
   is used to hold the configuration data.  If host-based access control
   is not desired, comment out HBA=1 in src/Makefile.global.
 * changed regex handling to be uniform use of Henry Spencer's regex code
   regardless of platform.  The regex code is included in the distribution
 * added functions and operators for case-insensitive regular expressions. 
   The operators are ~* and !~*.
 * pg_dump uses COPY instead of SELECT loop for better performance

臭虫修补∶
 * fixed an optimizer bug that was causing core dumps when 
   functions calls were used in comparisons in the WHERE clause
 * changed all uses of getuid to geteuid so that effective uids are used
 * psql now returns non-zero status on errors when using -c
 * applied public patches 1-14