Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 2ae5d51

Browse files
committed
From: Tatsuo Ishii <t-ishii@sra.co.jp> 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().
1 parent e27f879 commit 2ae5d51

File tree

4 files changed

+9
-11
lines changed

4 files changed

+9
-11
lines changed

src/backend/parser/analyze.c

+2-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* Copyright (c) 1994, Regents of the University of California
77
*
8-
* $Id: analyze.c,v 1.95 1999/01/25 12:01:05 vadim Exp $
8+
* $Id: analyze.c,v 1.96 1999/01/27 01:18:20 scrappy Exp $
99
*
1010
*-------------------------------------------------------------------------
1111
*/
@@ -714,6 +714,7 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
714714
index = makeNode(IndexStmt);
715715

716716
index->unique = TRUE;
717+
index->primary = (constraint->contype == CONSTR_PRIMARY ? TRUE:FALSE);
717718
if (constraint->name != NULL)
718719
index->idxname = constraint->name;
719720
else if (constraint->contype == CONSTR_PRIMARY)
@@ -722,14 +723,10 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
722723
elog(ERROR, "CREATE TABLE/PRIMARY KEY multiple keys for table %s are not legal", stmt->relname);
723724

724725
have_pkey = TRUE;
725-
index->primary = TRUE;
726726
index->idxname = makeTableName(stmt->relname, "pkey", NULL);
727727
}
728728
else
729-
{
730-
index->primary = FALSE;
731729
index->idxname = NULL;
732-
}
733730

734731
index->relname = stmt->relname;
735732
index->accessMethod = "btree";

src/bin/psql/psql.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.166 1999/01/17 06:19:19 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.167 1999/01/27 01:18:21 scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -1509,7 +1509,8 @@ do_connect(const char *new_dbname,
15091509
PGCLIENTENCODING value. -- 1998/12/12 Tatsuo Ishii */
15101510

15111511
if (!has_client_encoding) {
1512-
unsetenv("PGCLIENTENCODING");
1512+
static const char ev[] = "PGCLIENTENCODING=";
1513+
putenv(ev);
15131514
}
15141515
#endif
15151516

src/interfaces/libpq/fe-connect.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.88 1999/01/17 06:19:35 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.89 1999/01/27 01:18:22 scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -816,7 +816,7 @@ PQsetenv(PGconn *conn)
816816
#ifdef MULTIBYTE
817817
/* query server encoding */
818818
env = getenv(envname);
819-
if (!env)
819+
if (!env || *env == NULL)
820820
{
821821
rtn = PQexec(conn, "select getdatabaseencoding()");
822822
if (rtn && PQresultStatus(rtn) == PGRES_TUPLES_OK)

src/interfaces/libpq/fe-print.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* didn't really belong there.
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.15 1998/10/06 14:16:50 tgl Exp $
12+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.16 1999/01/27 01:18:23 scrappy Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -506,7 +506,7 @@ PQmblen(unsigned char *s)
506506
int encoding = -1;
507507

508508
str = getenv("PGCLIENTENCODING");
509-
if (str)
509+
if (str && *str != NULL)
510510
encoding = pg_char_to_encoding(str);
511511
if (encoding < 0)
512512
encoding = MULTIBYTE;

0 commit comments

Comments
 (0)