From: Tatsuo Ishii
authorMarc G. Fournier
Wed, 27 Jan 1999 01:18:23 +0000 (01:18 +0000)
committerMarc G. Fournier
Wed, 27 Jan 1999 01:18:23 +0000 (01:18 +0000)
Included patches fix a portability problem of unsetenv() used in
6.4.2 multi-byte support. unsetenv() is only avaliable on FreeBSD and
Linux so I decided to replace with putenv().

src/backend/parser/analyze.c
src/bin/psql/psql.c
src/interfaces/libpq/fe-connect.c
src/interfaces/libpq/fe-print.c

index 11b78c39266d9b0976bc66954ebc8d8e8534d2fe..f5b19d13a1be55c10a1d1732eaacc0badcb66809 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- *  $Id: analyze.c,v 1.95 1999/01/25 12:01:05 vadim Exp $
+ *  $Id: analyze.c,v 1.96 1999/01/27 01:18:20 scrappy Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -714,6 +714,7 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
        index = makeNode(IndexStmt);
 
        index->unique = TRUE;
+       index->primary = (constraint->contype == CONSTR_PRIMARY ? TRUE:FALSE);
        if (constraint->name != NULL)
            index->idxname = constraint->name;
        else if (constraint->contype == CONSTR_PRIMARY)
@@ -722,14 +723,10 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
                elog(ERROR, "CREATE TABLE/PRIMARY KEY multiple keys for table %s are not legal", stmt->relname);
 
            have_pkey = TRUE;
-           index->primary = TRUE;
            index->idxname = makeTableName(stmt->relname, "pkey", NULL);
        }
        else
-       {
-           index->primary = FALSE;
            index->idxname = NULL;
-       }
 
        index->relname = stmt->relname;
        index->accessMethod = "btree";
index 453d7ae7e11d22025ff2099b25a73dac241af372..cdd4c1d0d5d2fc9a7a10322804fc3a9896b00b19 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.166 1999/01/17 06:19:19 momjian Exp $
+ *   $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.167 1999/01/27 01:18:21 scrappy Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1509,7 +1509,8 @@ do_connect(const char *new_dbname,
           PGCLIENTENCODING value. -- 1998/12/12 Tatsuo Ishii */
           
        if (!has_client_encoding) {
-           unsetenv("PGCLIENTENCODING");
+               static const char ev[] = "PGCLIENTENCODING=";
+           putenv(ev);
        }
 #endif
 
index 4c5f70035aeaacccc13dff84676eafad52ec3b0a..f36086122474c2c4a559e0ea04290cb46e217374 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.88 1999/01/17 06:19:35 momjian Exp $
+ *   $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.89 1999/01/27 01:18:22 scrappy Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -816,7 +816,7 @@ PQsetenv(PGconn *conn)
 #ifdef MULTIBYTE
    /* query server encoding */
    env = getenv(envname);
-   if (!env)
+   if (!env || *env == NULL)
    {
        rtn = PQexec(conn, "select getdatabaseencoding()");
        if (rtn && PQresultStatus(rtn) == PGRES_TUPLES_OK)
index 08e111310acc97eb57a6671f2e5e9dcf7b30e989..a99fc27ba2658a2f06acb5eb14016b6f2397ae8e 100644 (file)
@@ -9,7 +9,7 @@
  * didn't really belong there.
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.15 1998/10/06 14:16:50 tgl Exp $
+ *   $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.16 1999/01/27 01:18:23 scrappy Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -506,7 +506,7 @@ PQmblen(unsigned char *s)
    int         encoding = -1;
 
    str = getenv("PGCLIENTENCODING");
-   if (str)
+   if (str && *str != NULL)
        encoding = pg_char_to_encoding(str);
    if (encoding < 0)
        encoding = MULTIBYTE;