E.50. 版本 1.01

發佈日期: 1996-02-23

E.50.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.50.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