1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-12 05:01:15 +03:00

Implement DROP CONVERSION

Add regression test
This commit is contained in:
Tatsuo Ishii
2002-07-25 10:07:13 +00:00
parent 8d600a7d1f
commit 0345f58496
16 changed files with 852 additions and 104 deletions

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/cache/syscache.c,v 1.83 2002/07/20 05:16:58 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/cache/syscache.c,v 1.84 2002/07/25 10:07:12 ishii Exp $
*
* NOTES
* These routines allow the parser/planner/executor to perform
@@ -206,6 +206,16 @@ static const struct cachedesc cacheinfo[] = {
0,
0
}},
{ConversionRelationName, /* CONDEFAULT */
ConversionDefaultIndex,
0,
4,
{
Anum_pg_conversion_connamespace,
Anum_pg_conversion_conforencoding,
Anum_pg_conversion_contoencoding,
ObjectIdAttributeNumber,
}},
{ConversionRelationName, /* CONNAMENSP */
ConversionNameNspIndex,
0,
@@ -216,6 +226,16 @@ static const struct cachedesc cacheinfo[] = {
0,
0
}},
{ConversionRelationName, /* CONOID */
ConversionOidIndex,
0,
1,
{
ObjectIdAttributeNumber,
0,
0,
0
}},
{GroupRelationName, /* GRONAME */
GroupNameIndex,
0,

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.93 2002/06/20 20:29:40 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.94 2002/07/25 10:07:12 ishii Exp $
*
*-------------------------------------------------------------------------
*/
@@ -185,56 +185,6 @@ SetDataDir(const char *dir)
DataDir = new;
}
/* ----------------------------------------------------------------
* MULTIBYTE stub code
*
* Even if MULTIBYTE is not enabled, these functions are necessary
* since pg_proc.h has references to them.
* ----------------------------------------------------------------
*/
#ifndef MULTIBYTE
Datum
getdatabaseencoding(PG_FUNCTION_ARGS)
{
return DirectFunctionCall1(namein, CStringGetDatum("SQL_ASCII"));
}
Datum
pg_client_encoding(PG_FUNCTION_ARGS)
{
return DirectFunctionCall1(namein, CStringGetDatum("SQL_ASCII"));
}
Datum
PG_encoding_to_char(PG_FUNCTION_ARGS)
{
return DirectFunctionCall1(namein, CStringGetDatum("SQL_ASCII"));
}
Datum
PG_char_to_encoding(PG_FUNCTION_ARGS)
{
PG_RETURN_INT32(0);
}
Datum
pg_convert(PG_FUNCTION_ARGS)
{
elog(ERROR, "convert is not supported. To use convert, you need to enable multibyte capability");
return DirectFunctionCall1(textin, CStringGetDatum(""));
}
Datum
pg_convert2(PG_FUNCTION_ARGS)
{
elog(ERROR, "convert is not supported. To use convert, you need to enable multibyte capability");
return DirectFunctionCall1(textin, CStringGetDatum(""));
}
#endif
/* ----------------------------------------------------------------
* CYR_RECODE support
* ----------------------------------------------------------------

View File

@@ -3,10 +3,10 @@
* client encoding and server internal encoding.
* (currently mule internal code (mic) is used)
* Tatsuo Ishii
* $Id: mbutils.c,v 1.28 2002/07/18 02:02:30 ishii Exp $
* $Id: mbutils.c,v 1.29 2002/07/25 10:07:12 ishii Exp $
*/
#include "postgres.h"
#include "access/xact.h"
#include "miscadmin.h"
#include "mb/pg_wchar.h"
#include "utils/builtins.h"
@@ -35,7 +35,8 @@ SetClientEncoding(int encoding, bool doit)
if (!PG_VALID_FE_ENCODING(encoding))
return (-1);
if (current_server_encoding == encoding)
if (current_server_encoding == encoding ||
(current_server_encoding == PG_SQL_ASCII || encoding == PG_SQL_ASCII))
{
ClientEncoding = &pg_enc2name_tbl[encoding];
return 0;
@@ -102,9 +103,15 @@ pg_do_encoding_conversion(unsigned char *src, int len,
unsigned char *result;
Oid proc;
if (!IsTransactionState())
return src;
if (src_encoding == dest_encoding)
return src;
if (src_encoding == PG_SQL_ASCII || dest_encoding == PG_SQL_ASCII)
return src;
proc = FindDefaultConversionProc(src_encoding, dest_encoding);
if (!OidIsValid(proc))
{