mirror of https://github.com/postgres/postgres
parent
6e66468f3a
commit
bf00bbb0c4
@ -0,0 +1,35 @@ |
|||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Makefile--
|
||||||
|
# Makefile for utils/mb
|
||||||
|
#
|
||||||
|
# IDENTIFICATION
|
||||||
|
# $Header: /cvsroot/pgsql/src/backend/utils/mb/Makefile,v 1.1 1998/07/24 03:31:54 scrappy Exp $
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
|
SRCDIR = ../../..
|
||||||
|
include ../../../Makefile.global |
||||||
|
|
||||||
|
CFLAGS += -I../..
|
||||||
|
ifdef MB |
||||||
|
CFLAGS += -DMB=$(MB)
|
||||||
|
endif |
||||||
|
|
||||||
|
OBJS = common.o conv.o mbutils.o wchar.o wstrcmp.o wstrncmp.o variable.o
|
||||||
|
|
||||||
|
all: SUBSYS.o |
||||||
|
|
||||||
|
SUBSYS.o: $(OBJS) |
||||||
|
$(LD) -r -o SUBSYS.o $(OBJS)
|
||||||
|
|
||||||
|
depend dep: |
||||||
|
$(CC) -MM $(CFLAGS) *.c >depend
|
||||||
|
|
||||||
|
clean: |
||||||
|
rm -f SUBSYS.o $(OBJS)
|
||||||
|
|
||||||
|
ifeq (depend,$(wildcard depend)) |
||||||
|
include depend |
||||||
|
endif |
||||||
|
|
@ -0,0 +1,10 @@ |
|||||||
|
common.c: public functions for both the backend and the frontend. |
||||||
|
requires conv.c and wchar.c |
||||||
|
conv.c: static functions and a public table for code conversion |
||||||
|
wchar.c: mostly static functions and a public table for mb string and |
||||||
|
multi-byte conversion |
||||||
|
mbutilc.c: public functions for the backend only. |
||||||
|
requires conv.c and wchar.c |
||||||
|
wstrcmp.c: strcmp for mb |
||||||
|
wstrncmp.c: strncmp for mb |
||||||
|
varable.c: public functions for show/set/reset variable commands |
@ -0,0 +1,67 @@ |
|||||||
|
/*
|
||||||
|
* This file contains some public functions |
||||||
|
* usable for both the backend and the frontend. |
||||||
|
* Tatsuo Ishii |
||||||
|
* $Id: common.c,v 1.1 1998/07/24 03:31:56 scrappy Exp $ */ |
||||||
|
|
||||||
|
#include <stdio.h> |
||||||
|
#include <string.h> |
||||||
|
|
||||||
|
#include "mb/pg_wchar.h" |
||||||
|
|
||||||
|
/*
|
||||||
|
* convert encoding char to encoding symbol value. |
||||||
|
* case is ignored. |
||||||
|
* if there's no valid encoding, returns -1 |
||||||
|
*/ |
||||||
|
int pg_char_to_encoding(const char *s) |
||||||
|
{ |
||||||
|
pg_encoding_conv_tbl *p = pg_conv_tbl; |
||||||
|
|
||||||
|
for(;p->encoding >= 0;p++) { |
||||||
|
if (!strcasecmp(s, p->name)) { |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
return(p->encoding); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* check to see if encoding name is valid |
||||||
|
*/ |
||||||
|
int pg_valid_client_encoding(const char *name) |
||||||
|
{ |
||||||
|
return(pg_char_to_encoding(name)); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* find encoding table entry by encoding |
||||||
|
*/ |
||||||
|
pg_encoding_conv_tbl *pg_get_encent_by_encoding(int encoding) |
||||||
|
{ |
||||||
|
pg_encoding_conv_tbl *p = pg_conv_tbl; |
||||||
|
for(;p->encoding >= 0;p++) { |
||||||
|
if (p->encoding == encoding) { |
||||||
|
return(p); |
||||||
|
} |
||||||
|
} |
||||||
|
return(0); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* convert encoding symbol to encoding char. |
||||||
|
* if there's no valid encoding symbol, returns "" |
||||||
|
*/ |
||||||
|
const char *pg_encoding_to_char(int encoding) |
||||||
|
{ |
||||||
|
pg_encoding_conv_tbl *p = pg_get_encent_by_encoding(encoding); |
||||||
|
|
||||||
|
if (!p) return(""); |
||||||
|
return(p->name); |
||||||
|
} |
||||||
|
|
||||||
|
/* returns the byte length of a multi-byte word for an encoding */ |
||||||
|
int pg_encoding_mblen(int encoding, const unsigned char *mbstr) |
||||||
|
{ |
||||||
|
return((*pg_wchar_table[encoding].mblen)(mbstr)); |
||||||
|
} |
@ -0,0 +1,216 @@ |
|||||||
|
/*
|
||||||
|
* This file contains public functions for conversion between |
||||||
|
* client encoding and server internal encoding. |
||||||
|
* (currently mule internal code (mic) is used) |
||||||
|
* Tatsuo Ishii |
||||||
|
* $Id: mbutils.c,v 1.1 1998/07/24 03:31:56 scrappy Exp $ */ |
||||||
|
|
||||||
|
#include <stdio.h> |
||||||
|
#include <string.h> |
||||||
|
|
||||||
|
#include "mb/pg_wchar.h" |
||||||
|
|
||||||
|
static client_encoding = -1; |
||||||
|
static void (*client_to_mic)(); /* something to MIC */ |
||||||
|
static void (*client_from_mic)(); /* MIC to something */ |
||||||
|
static void (*server_to_mic)(); /* something to MIC */ |
||||||
|
static void (*server_from_mic)(); /* MIC to something */ |
||||||
|
|
||||||
|
/*
|
||||||
|
* find encoding table entry by encoding |
||||||
|
*/ |
||||||
|
static pg_encoding_conv_tbl *get_enc_ent(int encoding) |
||||||
|
{ |
||||||
|
pg_encoding_conv_tbl *p = pg_conv_tbl; |
||||||
|
for(;p->encoding >= 0;p++) { |
||||||
|
if (p->encoding == encoding) { |
||||||
|
return(p); |
||||||
|
} |
||||||
|
} |
||||||
|
return(0); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* set the client encoding. if client/server encoding is |
||||||
|
* not supported, returns -1 |
||||||
|
*/ |
||||||
|
int pg_set_client_encoding(int encoding) |
||||||
|
{ |
||||||
|
int current_server_encoding = GetDatabaseEncoding(); |
||||||
|
|
||||||
|
client_encoding = encoding; |
||||||
|
|
||||||
|
if (client_encoding == current_server_encoding) { /* server == client? */ |
||||||
|
client_to_mic = client_from_mic = 0; |
||||||
|
server_to_mic = server_from_mic = 0; |
||||||
|
} else if (current_server_encoding == MULE_INTERNAL) { /* server == MULE_INETRNAL? */ |
||||||
|
client_to_mic = get_enc_ent(encoding)->to_mic; |
||||||
|
client_from_mic = get_enc_ent(encoding)->from_mic; |
||||||
|
server_to_mic = server_from_mic = 0; |
||||||
|
if (client_to_mic == 0 || client_from_mic == 0) { |
||||||
|
return(-1); |
||||||
|
} |
||||||
|
} else if (encoding == MULE_INTERNAL) { /* client == MULE_INETRNAL? */ |
||||||
|
client_to_mic = client_from_mic = 0; |
||||||
|
server_to_mic = get_enc_ent(current_server_encoding)->to_mic; |
||||||
|
server_from_mic = get_enc_ent(current_server_encoding)->from_mic; |
||||||
|
if (server_to_mic == 0 || server_from_mic == 0) { |
||||||
|
return(-1); |
||||||
|
} |
||||||
|
} else { |
||||||
|
client_to_mic = get_enc_ent(encoding)->to_mic; |
||||||
|
client_from_mic = get_enc_ent(encoding)->from_mic; |
||||||
|
server_to_mic = get_enc_ent(current_server_encoding)->to_mic; |
||||||
|
server_from_mic = get_enc_ent(current_server_encoding)->from_mic; |
||||||
|
if (client_to_mic == 0 || client_from_mic == 0) { |
||||||
|
return(-1); |
||||||
|
} |
||||||
|
if (server_to_mic == 0 || server_from_mic == 0) { |
||||||
|
return(-1); |
||||||
|
} |
||||||
|
} |
||||||
|
return(0); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* returns the current client encoding |
||||||
|
*/ |
||||||
|
int pg_get_client_encoding() |
||||||
|
{ |
||||||
|
if (client_encoding == -1) { |
||||||
|
/* this is the first time */ |
||||||
|
client_encoding = GetDatabaseEncoding(); |
||||||
|
} |
||||||
|
return(client_encoding); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* convert client encoding to server encoding. if server_encoding == |
||||||
|
* client_encoding or no conversion function exists, |
||||||
|
* returns s. So be careful. |
||||||
|
*/ |
||||||
|
unsigned char *pg_client_to_server(unsigned char *s, int len) |
||||||
|
{ |
||||||
|
static unsigned char b1[MAX_PARSE_BUFFER*4]; /* is this enough? */ |
||||||
|
static unsigned char b2[MAX_PARSE_BUFFER*4]; /* is this enough? */ |
||||||
|
unsigned char *p = s; |
||||||
|
|
||||||
|
if (client_encoding == GetDatabaseEncoding()) { |
||||||
|
return(p); |
||||||
|
} |
||||||
|
if (client_to_mic) { |
||||||
|
(*client_to_mic)(s, b1, len); |
||||||
|
len = strlen(b1); |
||||||
|
p = b1; |
||||||
|
} |
||||||
|
if (server_from_mic) { |
||||||
|
(*server_from_mic)(p, b2, len); |
||||||
|
p = b2; |
||||||
|
} |
||||||
|
return(p); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* convert server encoding to client encoding. if server_encoding == |
||||||
|
* client_encoding or no conversion function exists, |
||||||
|
* returns s. So be careful. |
||||||
|
*/ |
||||||
|
unsigned char *pg_server_to_client(unsigned char *s, int len) |
||||||
|
{ |
||||||
|
static unsigned char b1[MAX_PARSE_BUFFER*4]; /* is this enough? */ |
||||||
|
static unsigned char b2[MAX_PARSE_BUFFER*4]; /* is this enough? */ |
||||||
|
unsigned char *p = s; |
||||||
|
|
||||||
|
if (client_encoding == GetDatabaseEncoding()) { |
||||||
|
return(p); |
||||||
|
} |
||||||
|
if (server_to_mic) { |
||||||
|
(*server_to_mic)(s, b1, len); |
||||||
|
len = strlen(b1); |
||||||
|
p = b1; |
||||||
|
} |
||||||
|
if (client_from_mic) { |
||||||
|
(*client_from_mic)(p, b2, len); |
||||||
|
p = b2; |
||||||
|
} |
||||||
|
return(p); |
||||||
|
} |
||||||
|
|
||||||
|
/* convert a multi-byte string to a wchar */ |
||||||
|
void pg_mb2wchar(const unsigned char *from, pg_wchar *to) |
||||||
|
{ |
||||||
|
(*pg_wchar_table[GetDatabaseEncoding()].mb2wchar_with_len)(from,to,strlen(from)); |
||||||
|
} |
||||||
|
|
||||||
|
/* convert a multi-byte string to a wchar with a limited length */ |
||||||
|
void pg_mb2wchar_with_len(const unsigned char *from, pg_wchar *to, int len) |
||||||
|
{ |
||||||
|
(*pg_wchar_table[GetDatabaseEncoding()].mb2wchar_with_len)(from,to,len); |
||||||
|
} |
||||||
|
|
||||||
|
/* returns the byte length of a multi-byte word */ |
||||||
|
int pg_mblen(const unsigned char *mbstr) |
||||||
|
{ |
||||||
|
return((*pg_wchar_table[GetDatabaseEncoding()].mblen)(mbstr)); |
||||||
|
} |
||||||
|
|
||||||
|
/* returns the length (counted as a wchar) of a multi-byte string */ |
||||||
|
int pg_mbstrlen(const unsigned char *mbstr) |
||||||
|
{ |
||||||
|
int len = 0; |
||||||
|
while (*mbstr) { |
||||||
|
mbstr += pg_mblen(mbstr); |
||||||
|
len++; |
||||||
|
} |
||||||
|
return(len); |
||||||
|
} |
||||||
|
|
||||||
|
/* returns the length (counted as a wchar) of a multi-byte string
|
||||||
|
(not necessarily NULL terminated) */ |
||||||
|
int pg_mbstrlen_with_len(const unsigned char *mbstr, int limit) |
||||||
|
{ |
||||||
|
int len = 0; |
||||||
|
int l; |
||||||
|
while (*mbstr && limit > 0) { |
||||||
|
l = pg_mblen(mbstr); |
||||||
|
limit -= l; |
||||||
|
mbstr += l; |
||||||
|
len++; |
||||||
|
} |
||||||
|
return(len); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* fuctions for utils/init |
||||||
|
*/ |
||||||
|
static int DatabaseEncoding = MB; |
||||||
|
void |
||||||
|
SetDatabaseEncoding(int encoding) |
||||||
|
{ |
||||||
|
DatabaseEncoding = encoding; |
||||||
|
} |
||||||
|
|
||||||
|
int |
||||||
|
GetDatabaseEncoding() |
||||||
|
{ |
||||||
|
return(DatabaseEncoding); |
||||||
|
} |
||||||
|
|
||||||
|
/* for builtin-function */ |
||||||
|
const char * |
||||||
|
getdatabaseencoding() |
||||||
|
{ |
||||||
|
return(pg_encoding_to_char(DatabaseEncoding)); |
||||||
|
} |
||||||
|
|
||||||
|
/* set and get template1 database encoding */ |
||||||
|
static int templateEncoding; |
||||||
|
void SetTemplateEncoding(int encoding) |
||||||
|
{ |
||||||
|
templateEncoding = encoding; |
||||||
|
} |
||||||
|
|
||||||
|
int GetTemplateEncoding() |
||||||
|
{ |
||||||
|
return(templateEncoding); |
||||||
|
} |
@ -1,6 +1,6 @@ |
|||||||
/*
|
/*
|
||||||
* testing of utf2wchar() |
* testing of utf2wchar() |
||||||
* $Id: utftest.c,v 1.1 1998/03/15 07:38:37 scrappy Exp $ |
* $Id: utftest.c,v 1.1 1998/07/24 03:31:57 scrappy Exp $ |
||||||
*/ |
*/ |
||||||
#include <regex/regex.h> |
#include <regex/regex.h> |
||||||
#include <regex/utils.h> |
#include <regex/utils.h> |
@ -0,0 +1,73 @@ |
|||||||
|
/*
|
||||||
|
* This file contains some public functions |
||||||
|
* related to show/set/reset variable commands. |
||||||
|
* Tatsuo Ishii |
||||||
|
* $Id: variable.c,v 1.1 1998/07/24 03:31:57 scrappy Exp $ |
||||||
|
*/ |
||||||
|
|
||||||
|
#include "mb/pg_wchar.h" |
||||||
|
|
||||||
|
bool |
||||||
|
parse_client_encoding(const char *value) |
||||||
|
{ |
||||||
|
int encoding; |
||||||
|
|
||||||
|
encoding = pg_valid_client_encoding(value); |
||||||
|
if (encoding < 0) { |
||||||
|
elog(ERROR, "Client encoding %s is not supported", value); |
||||||
|
} else {
|
||||||
|
if (pg_set_client_encoding(encoding)) { |
||||||
|
elog(ERROR, "Conversion between %s and %s is not supported", |
||||||
|
value, pg_encoding_to_char(GetDatabaseEncoding())); |
||||||
|
} |
||||||
|
} |
||||||
|
return TRUE; |
||||||
|
} |
||||||
|
|
||||||
|
bool |
||||||
|
show_client_encoding() |
||||||
|
{ |
||||||
|
elog(NOTICE, "Current client encoding is %s", |
||||||
|
pg_encoding_to_char(pg_get_client_encoding())); |
||||||
|
return TRUE; |
||||||
|
} |
||||||
|
|
||||||
|
bool |
||||||
|
reset_client_encoding() |
||||||
|
{ |
||||||
|
int encoding; |
||||||
|
char *env = getenv("PGCLIENTENCODING"); |
||||||
|
|
||||||
|
if (env) { |
||||||
|
encoding = pg_char_to_encoding(env); |
||||||
|
if (encoding < 0) { |
||||||
|
encoding = GetDatabaseEncoding(); |
||||||
|
} |
||||||
|
} else { |
||||||
|
encoding = GetDatabaseEncoding(); |
||||||
|
} |
||||||
|
pg_set_client_encoding(encoding); |
||||||
|
return TRUE; |
||||||
|
} |
||||||
|
|
||||||
|
bool |
||||||
|
parse_server_encoding(const char *value) |
||||||
|
{ |
||||||
|
elog(NOTICE, "SET SERVER_ENCODING is not supported"); |
||||||
|
return TRUE; |
||||||
|
} |
||||||
|
|
||||||
|
bool |
||||||
|
show_server_encoding() |
||||||
|
{ |
||||||
|
elog(NOTICE, "Current server encoding is %s", |
||||||
|
pg_encoding_to_char(GetDatabaseEncoding())); |
||||||
|
return TRUE; |
||||||
|
} |
||||||
|
|
||||||
|
bool |
||||||
|
reset_server_encoding() |
||||||
|
{ |
||||||
|
elog(NOTICE, "RESET SERVER_ENCODING is not supported"); |
||||||
|
return TRUE; |
||||||
|
} |
@ -1,383 +0,0 @@ |
|||||||
#!/bin/sh |
|
||||||
#------------------------------------------------------------------------- |
|
||||||
# |
|
||||||
# initdb.sh-- |
|
||||||
# Create (initialize) a Postgres database system. |
|
||||||
# |
|
||||||
# A database system is a collection of Postgres databases all managed |
|
||||||
# by the same postmaster. |
|
||||||
# |
|
||||||
# To create the database system, we create the directory that contains |
|
||||||
# all its data, create the files that hold the global classes, create |
|
||||||
# a few other control files for it, and create one database: the |
|
||||||
# template database. |
|
||||||
# |
|
||||||
# The template database is an ordinary Postgres database. Its data |
|
||||||
# never changes, though. It exists to make it easy for Postgres to |
|
||||||
# create other databases -- it just copies. |
|
||||||
# |
|
||||||
# Optionally, we can skip creating the database system and just create |
|
||||||
# (or replace) the template database. |
|
||||||
# |
|
||||||
# To create all those classes, we run the postgres (backend) program and |
|
||||||
# feed it data from bki files that are in the Postgres library directory. |
|
||||||
# |
|
||||||
# Copyright (c) 1994, Regents of the University of California |
|
||||||
# |
|
||||||
# |
|
||||||
# IDENTIFICATION |
|
||||||
# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb,v 1.1 1998/04/06 01:05:52 momjian Exp $ |
|
||||||
# |
|
||||||
#------------------------------------------------------------------------- |
|
||||||
|
|
||||||
# ---------------- |
|
||||||
# The _fUnKy_..._sTuFf_ gets set when the script is built (with make) |
|
||||||
# from parameters set in the make file. |
|
||||||
# |
|
||||||
# ---------------- |
|
||||||
|
|
||||||
CMDNAME=`basename $0` |
|
||||||
|
|
||||||
# Find the default PGLIB directory (the directory that contains miscellaneous |
|
||||||
# files that are part of Postgres). The user-written program postconfig |
|
||||||
# outputs variable settings like "PGLIB=/usr/lib/whatever". If it doesn't |
|
||||||
# output a PGLIB value, then there is no default and the user must |
|
||||||
# specify the pglib option. Postconfig may validly not exist, in which case |
|
||||||
# our invocation of it silently fails. |
|
||||||
|
|
||||||
# The 2>/dev/null is to swallow the "postconfig: not found" message if there |
|
||||||
# is no postconfig. |
|
||||||
|
|
||||||
postconfig_result="`sh -c postconfig 2>/dev/null`" |
|
||||||
if [ ! -z "$postconfig_result" ]; then |
|
||||||
set -a # Make the following variable assignment exported to environment |
|
||||||
eval "$postconfig_result" |
|
||||||
set +a # back to normal |
|
||||||
fi |
|
||||||
|
|
||||||
# Set defaults: |
|
||||||
debug=0 |
|
||||||
noclean=0 |
|
||||||
template_only=0 |
|
||||||
POSTGRES_SUPERUSERNAME=$USER |
|
||||||
|
|
||||||
while [ "$#" -gt 0 ] |
|
||||||
do |
|
||||||
# ${ARG#--username=} is not reliable or available on all platforms |
|
||||||
|
|
||||||
case "$1" in |
|
||||||
--debug|-d) |
|
||||||
debug=1 |
|
||||||
echo "Running with debug mode on." |
|
||||||
;; |
|
||||||
--noclean|-n) |
|
||||||
noclean=1 |
|
||||||
echo "Running with noclean mode on. " |
|
||||||
"Mistakes will not be cleaned up." |
|
||||||
;; |
|
||||||
--template|-t) |
|
||||||
template_only=1 |
|
||||||
echo "updating template1 database only." |
|
||||||
;; |
|
||||||
--username=*) |
|
||||||
POSTGRES_SUPERUSERNAME="`echo $1 | sed 's/^--username=//'`" |
|
||||||
;; |
|
||||||
-u) |
|
||||||
shift |
|
||||||
POSTGRES_SUPERUSERNAME="$1" |
|
||||||
;; |
|
||||||
-u*) |
|
||||||
POSTGRES_SUPERUSERNAME="`echo $1 | sed 's/^-u//'`" |
|
||||||
;; |
|
||||||
--pgdata=*) |
|
||||||
PGDATA="`echo $1 | sed 's/^--pgdata=//'`" |
|
||||||
;; |
|
||||||
-r) |
|
||||||
shift |
|
||||||
PGDATA="$1" |
|
||||||
;; |
|
||||||
-r*) |
|
||||||
PGDATA="`echo $1 | sed 's/^-r//'`" |
|
||||||
;; |
|
||||||
--pglib=*) |
|
||||||
PGLIB="`echo $1 | sed 's/^--pglib=//'`" |
|
||||||
;; |
|
||||||
-l) |
|
||||||
shift |
|
||||||
PGLIB="$1" |
|
||||||
;; |
|
||||||
-l*) |
|
||||||
PGLIB="`echo $1 | sed 's/^-l//'`" |
|
||||||
;; |
|
||||||
|
|
||||||
*) |
|
||||||
echo "Unrecognized option '$1'. Syntax is:" |
|
||||||
echo "initdb [-t | --template] [-d | --debug]" \ |
|
||||||
"[-n | --noclean]" \ |
|
||||||
"[-u SUPERUSER | --username=SUPERUSER]" \ |
|
||||||
"[-r DATADIR | --pgdata=DATADIR]" \ |
|
||||||
"[-l LIBDIR | --pglib=LIBDIR]" |
|
||||||
exit 100 |
|
||||||
esac |
|
||||||
shift |
|
||||||
done |
|
||||||
|
|
||||||
#------------------------------------------------------------------------- |
|
||||||
# Make sure he told us where to find the Postgres files. |
|
||||||
#------------------------------------------------------------------------- |
|
||||||
if [ -z "$PGLIB" ]; then |
|
||||||
echo "$CMDNAME does not know where to find the files that make up " |
|
||||||
echo "Postgres (the PGLIB directory). You must identify the PGLIB " |
|
||||||
echo "directory either with a --pglib invocation option, or by " |
|
||||||
echo "setting the PGLIB environment variable, or by having a program " |
|
||||||
echo "called 'postconfig' in your search path that outputs an asignment " |
|
||||||
echo "for PGLIB." |
|
||||||
exit 20 |
|
||||||
fi |
|
||||||
|
|
||||||
#------------------------------------------------------------------------- |
|
||||||
# Make sure he told us where to build the database system |
|
||||||
#------------------------------------------------------------------------- |
|
||||||
|
|
||||||
if [ -z "$PGDATA" ]; then |
|
||||||
echo "$CMDNAME: You must identify the PGDATA directory, where the data" |
|
||||||
echo "for this database system will reside. Do this with either a" |
|
||||||
echo "--pgdata invocation option or a PGDATA environment variable." |
|
||||||
echo |
|
||||||
exit 20 |
|
||||||
fi |
|
||||||
|
|
||||||
TEMPLATE=$PGLIB/local1_template1.bki.source |
|
||||||
GLOBAL=$PGLIB/global1.bki.source |
|
||||||
TEMPLATE_DESCR=$PGLIB/local1_template1.description |
|
||||||
GLOBAL_DESCR=$PGLIB/global1.description |
|
||||||
PG_HBA_SAMPLE=$PGLIB/pg_hba.conf.sample |
|
||||||
PG_GEQO_SAMPLE=$PGLIB/pg_geqo.sample |
|
||||||
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------- |
|
||||||
# Find the input files |
|
||||||
#------------------------------------------------------------------------- |
|
||||||
|
|
||||||
for PREREQ_FILE in $TEMPLATE $GLOBAL $PG_HBA_SAMPLE; do |
|
||||||
if [ ! -f $PREREQ_FILE ]; then |
|
||||||
echo "$CMDNAME does not find the file '$PREREQ_FILE'." |
|
||||||
echo "This means you have identified an invalid PGLIB directory." |
|
||||||
echo "You specify a PGLIB directory with a --pglib invocation " |
|
||||||
echo "option, a PGLIB environment variable, or a postconfig program." |
|
||||||
exit 1 |
|
||||||
fi |
|
||||||
done |
|
||||||
|
|
||||||
echo "$CMDNAME: using $TEMPLATE as input to create the template database." |
|
||||||
if [ $template_only -eq 0 ]; then |
|
||||||
echo "$CMDNAME: using $GLOBAL as input to create the global classes." |
|
||||||
echo "$CMDNAME: using $PG_HBA_SAMPLE as the host-based authentication" \ |
|
||||||
"control file." |
|
||||||
echo |
|
||||||
fi |
|
||||||
|
|
||||||
#--------------------------------------------------------------------------- |
|
||||||
# Figure out who the Postgres superuser for the new database system will be. |
|
||||||
#--------------------------------------------------------------------------- |
|
||||||
|
|
||||||
if [ -z "$POSTGRES_SUPERUSERNAME" ]; then |
|
||||||
echo "Can't tell what username to use. You don't have the USER" |
|
||||||
echo "environment variable set to your username and didn't specify the " |
|
||||||
echo "--username option" |
|
||||||
exit 1 |
|
||||||
fi |
|
||||||
|
|
||||||
POSTGRES_SUPERUID=`pg_id $POSTGRES_SUPERUSERNAME` |
|
||||||
|
|
||||||
if [ $POSTGRES_SUPERUID = NOUSER ]; then |
|
||||||
echo "Valid username not given. You must specify the username for " |
|
||||||
echo "the Postgres superuser for the database system you are " |
|
||||||
echo "initializing, either with the --username option or by default " |
|
||||||
echo "to the USER environment variable." |
|
||||||
exit 10 |
|
||||||
fi |
|
||||||
|
|
||||||
if [ $POSTGRES_SUPERUID -ne `pg_id` -a `pg_id` -ne 0 ]; then |
|
||||||
echo "Only the unix superuser may initialize a database with a different" |
|
||||||
echo "Postgres superuser. (You must be able to create files that belong" |
|
||||||
echo "to the specified unix user)." |
|
||||||
exit 2 |
|
||||||
fi |
|
||||||
|
|
||||||
echo "We are initializing the database system with username" \ |
|
||||||
"$POSTGRES_SUPERUSERNAME (uid=$POSTGRES_SUPERUID)." |
|
||||||
echo "This user will own all the files and must also own the server process." |
|
||||||
echo |
|
||||||
|
|
||||||
# ----------------------------------------------------------------------- |
|
||||||
# Create the data directory if necessary |
|
||||||
# ----------------------------------------------------------------------- |
|
||||||
|
|
||||||
# umask must disallow access to group, other for files and dirs |
|
||||||
umask 077 |
|
||||||
|
|
||||||
if [ -f "$PGDATA/PG_VERSION" ]; then |
|
||||||
if [ $template_only -eq 0 ]; then |
|
||||||
echo "$CMDNAME: error: File $PGDATA/PG_VERSION already exists." |
|
||||||
echo "This probably means initdb has already been run and the " |
|
||||||
echo "database system already exists." |
|
||||||
echo |
|
||||||
echo "If you want to create a new database system, either remove " |
|
||||||
echo "the $PGDATA directory or run initdb with a --pgdata option " |
|
||||||
echo "other than $PGDATA." |
|
||||||
exit 1 |
|
||||||
fi |
|
||||||
else |
|
||||||
if [ ! -d $PGDATA ]; then |
|
||||||
echo "Creating Postgres database system directory $PGDATA" |
|
||||||
echo |
|
||||||
mkdir $PGDATA |
|
||||||
if [ $? -ne 0 ]; then exit 5; fi |
|
||||||
fi |
|
||||||
if [ ! -d $PGDATA/base ]; then |
|
||||||
echo "Creating Postgres database system directory $PGDATA/base" |
|
||||||
echo |
|
||||||
mkdir $PGDATA/base |
|
||||||
if [ $? -ne 0 ]; then exit 5; fi |
|
||||||
fi |
|
||||||
fi |
|
||||||
|
|
||||||
#---------------------------------------------------------------------------- |
|
||||||
# Create the template1 database |
|
||||||
#---------------------------------------------------------------------------- |
|
||||||
|
|
||||||
rm -rf $PGDATA/base/template1 |
|
||||||
mkdir $PGDATA/base/template1 |
|
||||||
|
|
||||||
if [ "$debug" -eq 1 ]; then |
|
||||||
BACKEND_TALK_ARG="-d" |
|
||||||
else |
|
||||||
BACKEND_TALK_ARG="-Q" |
|
||||||
fi |
|
||||||
|
|
||||||
BACKENDARGS="-boot -C -F -D$PGDATA $BACKEND_TALK_ARG" |
|
||||||
|
|
||||||
echo "$CMDNAME: creating template database in $PGDATA/base/template1" |
|
||||||
echo "Running: postgres $BACKENDARGS template1" |
|
||||||
|
|
||||||
cat $TEMPLATE \ |
|
||||||
| sed -e "s/postgres PGUID/$POSTGRES_SUPERUSERNAME $POSTGRES_SUPERUID/" \ |
|
||||||
-e "s/PGUID/$POSTGRES_SUPERUID/" \ |
|
||||||
| postgres $BACKENDARGS template1 |
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then |
|
||||||
echo "$CMDNAME: could not create template database" |
|
||||||
if [ $noclean -eq 0 ]; then |
|
||||||
echo "$CMDNAME: cleaning up by wiping out $PGDATA/base/template1" |
|
||||||
rm -rf $PGDATA/base/template1 |
|
||||||
else |
|
||||||
echo "$CMDNAME: cleanup not done because noclean options was used." |
|
||||||
fi |
|
||||||
exit 1; |
|
||||||
fi |
|
||||||
|
|
||||||
echo |
|
||||||
|
|
||||||
pg_version $PGDATA/base/template1 |
|
||||||
|
|
||||||
#---------------------------------------------------------------------------- |
|
||||||
# Create the global classes, if requested. |
|
||||||
#---------------------------------------------------------------------------- |
|
||||||
|
|
||||||
if [ $template_only -eq 0 ]; then |
|
||||||
echo "Creating global classes in $PG_DATA/base" |
|
||||||
echo "Running: postgres $BACKENDARGS template1" |
|
||||||
|
|
||||||
cat $GLOBAL \ |
|
||||||
| sed -e "s/postgres PGUID/$POSTGRES_SUPERUSERNAME $POSTGRES_SUPERUID/" \ |
|
||||||
-e "s/PGUID/$POSTGRES_SUPERUID/" \ |
|
||||||
| postgres $BACKENDARGS template1 |
|
||||||
|
|
||||||
if (test $? -ne 0) |
|
||||||
then |
|
||||||
echo "$CMDNAME: could not create global classes." |
|
||||||
if (test $noclean -eq 0); then |
|
||||||
echo "$CMDNAME: cleaning up." |
|
||||||
rm -rf $PGDATA |
|
||||||
else |
|
||||||
echo "$CMDNAME: cleanup not done (noclean mode set)." |
|
||||||
fi |
|
||||||
exit 1; |
|
||||||
fi |
|
||||||
|
|
||||||
echo |
|
||||||
|
|
||||||
pg_version $PGDATA |
|
||||||
|
|
||||||
cp $PG_HBA_SAMPLE $PGDATA/pg_hba.conf |
|
||||||
cp $PG_GEQO_SAMPLE $PGDATA/pg_geqo.sample |
|
||||||
|
|
||||||
echo "Adding template1 database to pg_database..." |
|
||||||
|
|
||||||
echo "open pg_database" > /tmp/create.$$ |
|
||||||
echo "insert (template1 $POSTGRES_SUPERUID template1)" >> /tmp/create.$$ |
|
||||||
#echo "show" >> /tmp/create.$$ |
|
||||||
echo "close pg_database" >> /tmp/create.$$ |
|
||||||
|
|
||||||
echo "Running: postgres $BACKENDARGS template1 < /tmp/create.$$" |
|
||||||
|
|
||||||
postgres $BACKENDARGS template1 < /tmp/create.$$ |
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then |
|
||||||
echo "$CMDNAME: could not log template database" |
|
||||||
if [ $noclean -eq 0 ]; then |
|
||||||
echo "$CMDNAME: cleaning up." |
|
||||||
rm -rf $PGDATA |
|
||||||
else |
|
||||||
echo "$CMDNAME: cleanup not done (noclean mode set)." |
|
||||||
fi |
|
||||||
exit 1; |
|
||||||
fi |
|
||||||
rm -f /tmp/create.$$ |
|
||||||
fi |
|
||||||
|
|
||||||
echo |
|
||||||
|
|
||||||
PGSQL_OPT="-o /dev/null -F -Q -D$PGDATA" |
|
||||||
|
|
||||||
# If the COPY is first, the VACUUM generates an error, so we vacuum first |
|
||||||
echo "vacuuming template1" |
|
||||||
echo "vacuum" | postgres $PGSQL_OPT template1 > /dev/null |
|
||||||
|
|
||||||
echo "COPY pg_shadow TO '$PGDATA/pg_pwd' USING DELIMITERS '\\t'" | \ |
|
||||||
postgres $PGSQL_OPT template1 > /dev/null |
|
||||||
|
|
||||||
echo "creating public pg_user view" |
|
||||||
echo "CREATE TABLE xpg_user ( \ |
|
||||||
usename name, \ |
|
||||||
usesysid int4, \ |
|
||||||
usecreatedb bool, \ |
|
||||||
usetrace bool, \ |
|
||||||
usesuper bool, \ |
|
||||||
usecatupd bool, \ |
|
||||||
passwd text, \ |
|
||||||
valuntil abstime);" | postgres $PGSQL_OPT template1 > /dev/null |
|
||||||
|
|
||||||
#move it into pg_user |
|
||||||
echo "UPDATE pg_class SET relname = 'pg_user' WHERE relname = 'xpg_user';" |\ |
|
||||||
postgres $PGSQL_OPT template1 > /dev/null |
|
||||||
echo "UPDATE pg_type SET typname = 'pg_user' WHERE typname = 'xpg_user';" |\ |
|
||||||
postgres $PGSQL_OPT template1 > /dev/null |
|
||||||
mv $PGDATA/base/template1/xpg_user $PGDATA/base/template1/pg_user |
|
||||||
|
|
||||||
echo "CREATE RULE _RETpg_user AS ON SELECT TO pg_user DO INSTEAD \ |
|
||||||
SELECT usename, usesysid, usecreatedb, usetrace, \ |
|
||||||
usesuper, usecatupd, '********'::text as passwd, \ |
|
||||||
valuntil FROM pg_shadow;" | \ |
|
||||||
postgres $PGSQL_OPT template1 > /dev/null |
|
||||||
echo "REVOKE ALL on pg_shadow FROM public" | \ |
|
||||||
postgres $PGSQL_OPT template1 > /dev/null |
|
||||||
|
|
||||||
echo "loading pg_description" |
|
||||||
echo "copy pg_description from '$TEMPLATE_DESCR'" | \ |
|
||||||
postgres $PGSQL_OPT template1 > /dev/null |
|
||||||
echo "copy pg_description from '$GLOBAL_DESCR'" | \ |
|
||||||
postgres $PGSQL_OPT template1 > /dev/null |
|
||||||
echo "vacuum analyze" | \ |
|
||||||
postgres $PGSQL_OPT template1 > /dev/null |
|
@ -0,0 +1,36 @@ |
|||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Makefile for bin/pg_encoding
|
||||||
|
#
|
||||||
|
# Copyright (c) 1998, PostgreSQL development group
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# IDENTIFICATION
|
||||||
|
# $Header: /cvsroot/pgsql/src/bin/pg_encoding/Attic/Makefile,v 1.1 1998/07/24 03:32:10 scrappy Exp $
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
|
SRCDIR= ../..
|
||||||
|
include ../../Makefile.global |
||||||
|
|
||||||
|
OBJS= pg_encoding.o
|
||||||
|
|
||||||
|
CFLAGS+= -DMB=$(MB) -I$(SRCDIR)/include
|
||||||
|
|
||||||
|
all: pg_encoding |
||||||
|
|
||||||
|
pg_encoding: $(OBJS) $(LIBPQDIR)/libpq.a |
||||||
|
$(CC) -o pg_encoding $(OBJS) -L$(LIBPQDIR) -lpq $(LDFLAGS)
|
||||||
|
|
||||||
|
install: pg_encoding |
||||||
|
$(INSTALL) $(INSTL_EXE_OPTS) pg_encoding $(BINDIR)/pg_encoding
|
||||||
|
|
||||||
|
depend dep: |
||||||
|
$(CC) -MM $(CFLAGS) *.c >depend
|
||||||
|
|
||||||
|
clean: |
||||||
|
rm -f pg_encoding pg_encoding.o
|
||||||
|
|
||||||
|
ifeq (depend,$(wildcard depend)) |
||||||
|
include depend |
||||||
|
endif |
@ -0,0 +1,49 @@ |
|||||||
|
/*-------------------------------------------------------------------------
|
||||||
|
* |
||||||
|
* pg_encoding.c-- |
||||||
|
* |
||||||
|
* |
||||||
|
* Copyright (c) 1998, PostgreSQL development group |
||||||
|
* |
||||||
|
* |
||||||
|
* IDENTIFICATION |
||||||
|
* $Header: /cvsroot/pgsql/src/bin/pg_encoding/Attic/pg_encoding.c,v 1.1 1998/07/24 03:32:10 scrappy Exp $ |
||||||
|
* |
||||||
|
*------------------------------------------------------------------------- |
||||||
|
*/ |
||||||
|
#include <stdlib.h> |
||||||
|
#include <stdio.h> |
||||||
|
#include "postgres.h" |
||||||
|
#include "mb/pg_wchar.h" |
||||||
|
|
||||||
|
static void usage(void); |
||||||
|
|
||||||
|
int |
||||||
|
main(int argc, char **argv) |
||||||
|
{ |
||||||
|
char c; |
||||||
|
char *p; |
||||||
|
int rtn; |
||||||
|
|
||||||
|
if (argc < 2) { |
||||||
|
usage(); |
||||||
|
exit(1); |
||||||
|
} |
||||||
|
p = argv[1]; |
||||||
|
while((c = *p++)) { |
||||||
|
if (c < '0' || c > '9') { |
||||||
|
rtn = pg_char_to_encoding(argv[1]); |
||||||
|
if (rtn >= 0) { |
||||||
|
printf("%d\n",rtn); |
||||||
|
} |
||||||
|
exit(0); |
||||||
|
} |
||||||
|
} |
||||||
|
printf("%s\n",pg_encoding_to_char(atoi(argv[1]))); |
||||||
|
exit(0); |
||||||
|
} |
||||||
|
|
||||||
|
static void usage() |
||||||
|
{ |
||||||
|
fprintf(stderr, "pg_encoding: encoding_name | encoding_number\n"); |
||||||
|
} |
@ -1,2 +0,0 @@ |
|||||||
#include "../../backend/commands/mbutils.c" |
|
||||||
|
|
@ -1 +0,0 @@ |
|||||||
#include "../../backend/regex/utils.c" |
|
@ -0,0 +1,9 @@ |
|||||||
|
README for MB(multi-byte) regression test |
||||||
|
1998/7/22 |
||||||
|
Tatsuo Ishii |
||||||
|
|
||||||
|
This directory contains a set of tests for MB(multi-byte) supporting |
||||||
|
extentions for PostgreSQL. To run the test, simply type: |
||||||
|
|
||||||
|
% mbregress.sh |
||||||
|
|
@ -0,0 +1,87 @@ |
|||||||
|
QUERY: drop table 计算机术语; |
||||||
|
ERROR: Relation 计算机术语 Does Not Exist! |
||||||
|
QUERY: create table 计算机术语(术语 text, 分类号 varchar, 备注1A char(16)); |
||||||
|
QUERY: create index 计算机术语index1 on 计算机术语 using btree(术语); |
||||||
|
QUERY: create index 计算机术语index2 on 计算机术语 using btree(分类号); |
||||||
|
QUERY: insert into 计算机术语 values('电脑显示屏','机A01上'); |
||||||
|
QUERY: insert into 计算机术语 values('电脑图形','分B01中'); |
||||||
|
QUERY: insert into 计算机术语 values('电脑程序员','人Z01下'); |
||||||
|
QUERY: vacuum 计算机术语; |
||||||
|
QUERY: select * from 计算机术语; |
||||||
|
术语 |分类号 |备注1a |
||||||
|
----------+-------+------ |
||||||
|
电脑显示屏|机A01上| |
||||||
|
电脑图形 |分B01中| |
||||||
|
电脑程序员|人Z01下| |
||||||
|
(3 rows) |
||||||
|
|
||||||
|
QUERY: select * from 计算机术语 where 分类号 = '人Z01下'; |
||||||
|
术语 |分类号 |备注1a |
||||||
|
----------+-------+------ |
||||||
|
电脑程序员|人Z01下| |
||||||
|
(1 row) |
||||||
|
|
||||||
|
QUERY: select * from 计算机术语 where 分类号 ~* '人z01下'; |
||||||
|
术语 |分类号 |备注1a |
||||||
|
----------+-------+------ |
||||||
|
电脑程序员|人Z01下| |
||||||
|
(1 row) |
||||||
|
|
||||||
|
QUERY: select * from 计算机术语 where 分类号 like '_Z01_'; |
||||||
|
术语 |分类号 |备注1a |
||||||
|
----------+-------+------ |
||||||
|
电脑程序员|人Z01下| |
||||||
|
(1 row) |
||||||
|
|
||||||
|
QUERY: select * from 计算机术语 where 分类号 like '_Z%'; |
||||||
|
术语 |分类号 |备注1a |
||||||
|
----------+-------+------ |
||||||
|
电脑程序员|人Z01下| |
||||||
|
(1 row) |
||||||
|
|
||||||
|
QUERY: select * from 计算机术语 where 术语 ~ '电脑[显图]'; |
||||||
|
术语 |分类号 |备注1a |
||||||
|
----------+-------+------ |
||||||
|
电脑显示屏|机A01上| |
||||||
|
电脑图形 |分B01中| |
||||||
|
(2 rows) |
||||||
|
|
||||||
|
QUERY: select * from 计算机术语 where 术语 ~* '电脑[显图]'; |
||||||
|
术语 |分类号 |备注1a |
||||||
|
----------+-------+------ |
||||||
|
电脑显示屏|机A01上| |
||||||
|
电脑图形 |分B01中| |
||||||
|
(2 rows) |
||||||
|
|
||||||
|
QUERY: select *,character_length(术语) from 计算机术语; |
||||||
|
术语 |分类号 |备注1a|length |
||||||
|
----------+-------+------+------ |
||||||
|
电脑显示屏|机A01上| | 5 |
||||||
|
电脑图形 |分B01中| | 4 |
||||||
|
电脑程序员|人Z01下| | 5 |
||||||
|
(3 rows) |
||||||
|
|
||||||
|
QUERY: select *,octet_length(术语) from 计算机术语; |
||||||
|
术语 |分类号 |备注1a|octet_length |
||||||
|
----------+-------+------+------------ |
||||||
|
电脑显示屏|机A01上| | 10 |
||||||
|
电脑图形 |分B01中| | 8 |
||||||
|
电脑程序员|人Z01下| | 10 |
||||||
|
(3 rows) |
||||||
|
|
||||||
|
QUERY: select *,position('显' in 术语) from 计算机术语; |
||||||
|
术语 |分类号 |备注1a|strpos |
||||||
|
----------+-------+------+------ |
||||||
|
电脑显示屏|机A01上| | 3 |
||||||
|
电脑图形 |分B01中| | 0 |
||||||
|
电脑程序员|人Z01下| | 0 |
||||||
|
(3 rows) |
||||||
|
|
||||||
|
QUERY: select *,substring(术语 from 3 for 4) from 计算机术语; |
||||||
|
术语 |分类号 |备注1a|substr |
||||||
|
----------+-------+------+------ |
||||||
|
电脑显示屏|机A01上| |显示屏 |
||||||
|
电脑图形 |分B01中| |图形 |
||||||
|
电脑程序员|人Z01下| |程序员 |
||||||
|
(3 rows) |
||||||
|
|
@ -0,0 +1,87 @@ |
|||||||
|
QUERY: drop table 計算機用語; |
||||||
|
ERROR: Relation 計算機用語 Does Not Exist! |
||||||
|
QUERY: create table 計算機用語 (用語 text, 分類コード varchar, 備考1Aだよ char(16)); |
||||||
|
QUERY: create index 計算機用語index1 on 計算機用語 using btree (用語); |
||||||
|
QUERY: create index 計算機用語index2 on 計算機用語 using hash (分類コード); |
||||||
|
QUERY: insert into 計算機用語 values('コンピュータディスプレイ','機A01上'); |
||||||
|
QUERY: insert into 計算機用語 values('コンピュータグラフィックス','分B10中'); |
||||||
|
QUERY: insert into 計算機用語 values('コンピュータプログラマー','人Z01下'); |
||||||
|
QUERY: vacuum 計算機用語; |
||||||
|
QUERY: select * from 計算機用語; |
||||||
|
用語 |分類コード|備考1aだよ |
||||||
|
--------------------------+----------+---------- |
||||||
|
コンピュータディスプレイ |機A01上 | |
||||||
|
コンピュータグラフィックス|分B10中 | |
||||||
|
コンピュータプログラマー |人Z01下 | |
||||||
|
(3 rows) |
||||||
|
|
||||||
|
QUERY: select * from 計算機用語 where 分類コード = '人Z01下'; |
||||||
|
用語 |分類コード|備考1aだよ |
||||||
|
------------------------+----------+---------- |
||||||
|
コンピュータプログラマー|人Z01下 | |
||||||
|
(1 row) |
||||||
|
|
||||||
|
QUERY: select * from 計算機用語 where 分類コード ~* '人z01下'; |
||||||
|
用語 |分類コード|備考1aだよ |
||||||
|
------------------------+----------+---------- |
||||||
|
コンピュータプログラマー|人Z01下 | |
||||||
|
(1 row) |
||||||
|
|
||||||
|
QUERY: select * from 計算機用語 where 分類コード like '_Z01_'; |
||||||
|
用語 |分類コード|備考1aだよ |
||||||
|
------------------------+----------+---------- |
||||||
|
コンピュータプログラマー|人Z01下 | |
||||||
|
(1 row) |
||||||
|
|
||||||
|
QUERY: select * from 計算機用語 where 分類コード like '_Z%'; |
||||||
|
用語 |分類コード|備考1aだよ |
||||||
|
------------------------+----------+---------- |
||||||
|
コンピュータプログラマー|人Z01下 | |
||||||
|
(1 row) |
||||||
|
|
||||||
|
QUERY: select * from 計算機用語 where 用語 ~ 'コンピュータ[デグ]'; |
||||||
|
用語 |分類コード|備考1aだよ |
||||||
|
--------------------------+----------+---------- |
||||||
|
コンピュータディスプレイ |機A01上 | |
||||||
|
コンピュータグラフィックス|分B10中 | |
||||||
|
(2 rows) |
||||||
|
|
||||||
|
QUERY: select * from 計算機用語 where 用語 ~* 'コンピュータ[デグ]'; |
||||||
|
用語 |分類コード|備考1aだよ |
||||||
|
--------------------------+----------+---------- |
||||||
|
コンピュータディスプレイ |機A01上 | |
||||||
|
コンピュータグラフィックス|分B10中 | |
||||||
|
(2 rows) |
||||||
|
|
||||||
|
QUERY: select *,character_length(用語) from 計算機用語; |
||||||
|
用語 |分類コード|備考1aだよ|length |
||||||
|
--------------------------+----------+----------+------ |
||||||
|
コンピュータディスプレイ |機A01上 | | 12 |
||||||
|
コンピュータグラフィックス|分B10中 | | 13 |
||||||
|
コンピュータプログラマー |人Z01下 | | 12 |
||||||
|
(3 rows) |
||||||
|
|
||||||
|
QUERY: select *,octet_length(用語) from 計算機用語; |
||||||
|
用語 |分類コード|備考1aだよ|octet_length |
||||||
|
--------------------------+----------+----------+------------ |
||||||
|
コンピュータディスプレイ |機A01上 | | 24 |
||||||
|
コンピュータグラフィックス|分B10中 | | 26 |
||||||
|
コンピュータプログラマー |人Z01下 | | 24 |
||||||
|
(3 rows) |
||||||
|
|
||||||
|
QUERY: select *,position('デ' in 用語) from 計算機用語; |
||||||
|
用語 |分類コード|備考1aだよ|strpos |
||||||
|
--------------------------+----------+----------+------ |
||||||
|
コンピュータディスプレイ |機A01上 | | 7 |
||||||
|
コンピュータグラフィックス|分B10中 | | 0 |
||||||
|
コンピュータプログラマー |人Z01下 | | 0 |
||||||
|
(3 rows) |
||||||
|
|
||||||
|
QUERY: select *,substring(用語 from 10 for 4) from 計算機用語; |
||||||
|
用語 |分類コード|備考1aだよ|substr |
||||||
|
--------------------------+----------+----------+-------- |
||||||
|
コンピュータディスプレイ |機A01上 | |プレイ |
||||||
|
コンピュータグラフィックス|分B10中 | |ィックス |
||||||
|
コンピュータプログラマー |人Z01下 | |ラマー |
||||||
|
(3 rows) |
||||||
|
|
@ -0,0 +1,87 @@ |
|||||||
|
QUERY: drop table 計算機용어; |
||||||
|
ERROR: Relation 計算機용어 Does Not Exist! |
||||||
|
QUERY: create table 計算機용어 (용어 text, 分類코드 varchar, 비고1A라구 char(16)); |
||||||
|
QUERY: create index 計算機용어index1 on 計算機용어 using btree (용어); |
||||||
|
QUERY: create index 計算機용어index2 on 計算機용어 using hash (分類코드); |
||||||
|
QUERY: insert into 計算機용어 values('컴퓨터디스플레이', '機A01上'); |
||||||
|
QUERY: insert into 計算機용어 values('컴퓨터그래픽스', '分B10中'); |
||||||
|
QUERY: insert into 計算機용어 values('컴퓨터프로그래머', '人Z01下'); |
||||||
|
QUERY: vacuum 計算機용어; |
||||||
|
QUERY: select * from 計算機용어; |
||||||
|
용어 |分類코드|비고1a라구 |
||||||
|
----------------+--------+---------- |
||||||
|
컴퓨터디스플레이|機A01上 | |
||||||
|
컴퓨터그래픽스 |分B10中 | |
||||||
|
컴퓨터프로그래머|人Z01下 | |
||||||
|
(3 rows) |
||||||
|
|
||||||
|
QUERY: select * from 計算機용어 where 分類코드 = '人Z01下'; |
||||||
|
용어 |分類코드|비고1a라구 |
||||||
|
----------------+--------+---------- |
||||||
|
컴퓨터프로그래머|人Z01下 | |
||||||
|
(1 row) |
||||||
|
|
||||||
|
QUERY: select * from 計算機용어 where 分類코드 ~* '人z01下'; |
||||||
|
용어 |分類코드|비고1a라구 |
||||||
|
----------------+--------+---------- |
||||||
|
컴퓨터프로그래머|人Z01下 | |
||||||
|
(1 row) |
||||||
|
|
||||||
|
QUERY: select * from 計算機용어 where 分類코드 like '_Z01_'; |
||||||
|
용어 |分類코드|비고1a라구 |
||||||
|
----------------+--------+---------- |
||||||
|
컴퓨터프로그래머|人Z01下 | |
||||||
|
(1 row) |
||||||
|
|
||||||
|
QUERY: select * from 計算機용어 where 分類코드 like '_Z%'; |
||||||
|
용어 |分類코드|비고1a라구 |
||||||
|
----------------+--------+---------- |
||||||
|
컴퓨터프로그래머|人Z01下 | |
||||||
|
(1 row) |
||||||
|
|
||||||
|
QUERY: select * from 計算機용어 where 용어 ~ '컴퓨터[디그]'; |
||||||
|
용어 |分類코드|비고1a라구 |
||||||
|
----------------+--------+---------- |
||||||
|
컴퓨터디스플레이|機A01上 | |
||||||
|
컴퓨터그래픽스 |分B10中 | |
||||||
|
(2 rows) |
||||||
|
|
||||||
|
QUERY: select * from 計算機용어 where 용어 ~* '컴퓨터[디그]'; |
||||||
|
용어 |分類코드|비고1a라구 |
||||||
|
----------------+--------+---------- |
||||||
|
컴퓨터디스플레이|機A01上 | |
||||||
|
컴퓨터그래픽스 |分B10中 | |
||||||
|
(2 rows) |
||||||
|
|
||||||
|
QUERY: select *,character_length(용어) from 計算機용어; |
||||||
|
용어 |分類코드|비고1a라구|length |
||||||
|
----------------+--------+----------+------ |
||||||
|
컴퓨터디스플레이|機A01上 | | 8 |
||||||
|
컴퓨터그래픽스 |分B10中 | | 7 |
||||||
|
컴퓨터프로그래머|人Z01下 | | 8 |
||||||
|
(3 rows) |
||||||
|
|
||||||
|
QUERY: select *,octet_length(용어) from 計算機용어; |
||||||
|
용어 |分類코드|비고1a라구|octet_length |
||||||
|
----------------+--------+----------+------------ |
||||||
|
컴퓨터디스플레이|機A01上 | | 16 |
||||||
|
컴퓨터그래픽스 |分B10中 | | 14 |
||||||
|
컴퓨터프로그래머|人Z01下 | | 16 |
||||||
|
(3 rows) |
||||||
|
|
||||||
|
QUERY: select *,position('디' in 용어) from 計算機용어; |
||||||
|
용어 |分類코드|비고1a라구|strpos |
||||||
|
----------------+--------+----------+------ |
||||||
|
컴퓨터디스플레이|機A01上 | | 4 |
||||||
|
컴퓨터그래픽스 |分B10中 | | 0 |
||||||
|
컴퓨터프로그래머|人Z01下 | | 0 |
||||||
|
(3 rows) |
||||||
|
|
||||||
|
QUERY: select *,substring(용어 from 3 for 4) from 計算機용어; |
||||||
|
용어 |分類코드|비고1a라구|substr |
||||||
|
----------------+--------+----------+-------- |
||||||
|
컴퓨터디스플레이|機A01上 | |터디스플 |
||||||
|
컴퓨터그래픽스 |分B10中 | |터그래픽 |
||||||
|
컴퓨터프로그래머|人Z01下 | |터프로그 |
||||||
|
(3 rows) |
||||||
|
|
@ -0,0 +1,90 @@ |
|||||||
|
QUERY: drop table 計算機用語; |
||||||
|
QUERY: create table 計算機用語 (用語 text, 分類コード varchar, 備考1Aだよ char(16)); |
||||||
|
QUERY: create index 計算機用語index1 on 計算機用語 using btree (用語); |
||||||
|
QUERY: create index 計算機用語index2 on 計算機用語 using hash (分類コード); |
||||||
|
QUERY: insert into 計算機用語 values('コンピュータディスプレイ','機A01上'); |
||||||
|
QUERY: insert into 計算機用語 values('コンピュータグラフィックス','分B10中'); |
||||||
|
QUERY: insert into 計算機用語 values('コンピュータプログラマー','人Z01下'); |
||||||
|
QUERY: vacuum 計算機用語; |
||||||
|
QUERY: select * from 計算機用語; |
||||||
|
用語 |分類コード|備考1aだよ |
||||||
|
--------------------------+----------+---------- |
||||||
|
コンピュータディスプレイ |機A01上 | |
||||||
|
コンピュータグラフィックス|分B10中 | |
||||||
|
コンピュータプログラマー |人Z01下 | |
||||||
|
(3 rows) |
||||||
|
|
||||||
|
QUERY: select * from 計算機用語 where 分類コード = '人Z01下'; |
||||||
|
用語 |分類コード|備考1aだよ |
||||||
|
------------------------+----------+---------- |
||||||
|
コンピュータプログラマー|人Z01下 | |
||||||
|
(1 row) |
||||||
|
|
||||||
|
QUERY: select * from 計算機用語 where 分類コード ~* '人z01下'; |
||||||
|
用語 |分類コード|備考1aだよ |
||||||
|
------------------------+----------+---------- |
||||||
|
コンピュータプログラマー|人Z01下 | |
||||||
|
(1 row) |
||||||
|
|
||||||
|
QUERY: select * from 計算機用語 where 分類コード like '_Z01_'; |
||||||
|
用語 |分類コード|備考1aだよ |
||||||
|
------------------------+----------+---------- |
||||||
|
コンピュータプログラマー|人Z01下 | |
||||||
|
(1 row) |
||||||
|
|
||||||
|
QUERY: select * from 計算機用語 where 分類コード like '_Z%'; |
||||||
|
用語 |分類コード|備考1aだよ |
||||||
|
------------------------+----------+---------- |
||||||
|
コンピュータプログラマー|人Z01下 | |
||||||
|
(1 row) |
||||||
|
|
||||||
|
QUERY: select * from 計算機用語 where 用語 ~ 'コンピュータ[デグ]'; |
||||||
|
用語 |分類コード|備考1aだよ |
||||||
|
--------------------------+----------+---------- |
||||||
|
コンピュータディスプレイ |機A01上 | |
||||||
|
コンピュータグラフィックス|分B10中 | |
||||||
|
(2 rows) |
||||||
|
|
||||||
|
QUERY: select * from 計算機用語 where 用語 ~* 'コンピュータ[デグ]'; |
||||||
|
用語 |分類コード|備考1aだよ |
||||||
|
--------------------------+----------+---------- |
||||||
|
コンピュータディスプレイ |機A01上 | |
||||||
|
コンピュータグラフィックス|分B10中 | |
||||||
|
(2 rows) |
||||||
|
|
||||||
|
QUERY: select *,character_length(用語) from 計算機用語; |
||||||
|
用語 |分類コード|備考1aだよ|length |
||||||
|
--------------------------+----------+----------+------ |
||||||
|
コンピュータディスプレイ |機A01上 | | 12 |
||||||
|
コンピュータグラフィックス|分B10中 | | 13 |
||||||
|
コンピュータプログラマー |人Z01下 | | 12 |
||||||
|
(3 rows) |
||||||
|
|
||||||
|
QUERY: select *,octet_length(用語) from 計算機用語; |
||||||
|
用語 |分類コード|備考1aだよ|octet_length |
||||||
|
--------------------------+----------+----------+------------ |
||||||
|
コンピュータディスプレイ |機A01上 | | 24 |
||||||
|
コンピュータグラフィックス|分B10中 | | 26 |
||||||
|
コンピュータプログラマー |人Z01下 | | 24 |
||||||
|
(3 rows) |
||||||
|
|
||||||
|
QUERY: select *,position('デ' in 用語) from 計算機用語; |
||||||
|
用語 |分類コード|備考1aだよ|strpos |
||||||
|
--------------------------+----------+----------+------ |
||||||
|
コンピュータディスプレイ |機A01上 | | 7 |
||||||
|
コンピュータグラフィックス|分B10中 | | 0 |
||||||
|
コンピュータプログラマー |人Z01下 | | 0 |
||||||
|
(3 rows) |
||||||
|
|
||||||
|
QUERY: select *,substring(用語 from 10 for 4) from 計算機用語; |
||||||
|
用語 |分類コード|備考1aだよ|substr |
||||||
|
--------------------------+----------+----------+-------- |
||||||
|
コンピュータディスプレイ |機A01上 | |プレイ |
||||||
|
コンピュータグラフィックス|分B10中 | |ィックス |
||||||
|
コンピュータプログラマー |人Z01下 | |ラマー |
||||||
|
(3 rows) |
||||||
|
|
||||||
|
QUERY: copy 計算機用語 to stdout; |
||||||
|
コンピュータディスプレイ 機A01上 \N |
||||||
|
コンピュータグラフィックス 分B10中 \N |
||||||
|
コンピュータプログラマー 人Z01下 \N |
@ -0,0 +1,87 @@ |
|||||||
|
QUERY: drop table 計算機用語; |
||||||
|
ERROR: Relation 計算機用語 Does Not Exist! |
||||||
|
QUERY: create table 計算機用語 (用語 text, 分類コード varchar, 備考1Aだよ char(16)); |
||||||
|
QUERY: create index 計算機用語index1 on 計算機用語 using btree (用語); |
||||||
|
QUERY: create index 計算機用語index2 on 計算機用語 using hash (分類コード); |
||||||
|
QUERY: insert into 計算機用語 values('コンピュータディスプレイ','機A01上'); |
||||||
|
QUERY: insert into 計算機用語 values('コンピュータグラフィックス','分B10中'); |
||||||
|
QUERY: insert into 計算機用語 values('コンピュータプログラマー','人Z01下'); |
||||||
|
QUERY: vacuum 計算機用語; |
||||||
|
QUERY: select * from 計算機用語; |
||||||
|
用語 |分類コード|備考1aだよ |
||||||
|
---------------------------------------+---------------+-------------- |
||||||
|
コンピュータディスプレイ |機A01上 | |
||||||
|
コンピュータグラフィックス|分B10中 | |
||||||
|
コンピュータプログラマー |人Z01下 | |
||||||
|
(3 rows) |
||||||
|
|
||||||
|
QUERY: select * from 計算機用語 where 分類コード = '人Z01下'; |
||||||
|
用語 |分類コード|備考1aだよ |
||||||
|
------------------------------------+---------------+-------------- |
||||||
|
コンピュータプログラマー|人Z01下 | |
||||||
|
(1 row) |
||||||
|
|
||||||
|
QUERY: select * from 計算機用語 where 分類コード ~* '人z01下'; |
||||||
|
用語 |分類コード|備考1aだよ |
||||||
|
------------------------------------+---------------+-------------- |
||||||
|
コンピュータプログラマー|人Z01下 | |
||||||
|
(1 row) |
||||||
|
|
||||||
|
QUERY: select * from 計算機用語 where 分類コード like '_Z01_'; |
||||||
|
用語 |分類コード|備考1aだよ |
||||||
|
------------------------------------+---------------+-------------- |
||||||
|
コンピュータプログラマー|人Z01下 | |
||||||
|
(1 row) |
||||||
|
|
||||||
|
QUERY: select * from 計算機用語 where 分類コード like '_Z%'; |
||||||
|
用語 |分類コード|備考1aだよ |
||||||
|
------------------------------------+---------------+-------------- |
||||||
|
コンピュータプログラマー|人Z01下 | |
||||||
|
(1 row) |
||||||
|
|
||||||
|
QUERY: select * from 計算機用語 where 用語 ~ 'コンピュータ[デグ]'; |
||||||
|
用語 |分類コード|備考1aだよ |
||||||
|
---------------------------------------+---------------+-------------- |
||||||
|
コンピュータディスプレイ |機A01上 | |
||||||
|
コンピュータグラフィックス|分B10中 | |
||||||
|
(2 rows) |
||||||
|
|
||||||
|
QUERY: select * from 計算機用語 where 用語 ~* 'コンピュータ[デグ]'; |
||||||
|
用語 |分類コード|備考1aだよ |
||||||
|
---------------------------------------+---------------+-------------- |
||||||
|
コンピュータディスプレイ |機A01上 | |
||||||
|
コンピュータグラフィックス|分B10中 | |
||||||
|
(2 rows) |
||||||
|
|
||||||
|
QUERY: select *,character_length(用語) from 計算機用語; |
||||||
|
用語 |分類コード|備考1aだよ|length |
||||||
|
---------------------------------------+---------------+--------------+------ |
||||||
|
コンピュータディスプレイ |機A01上 | | 12 |
||||||
|
コンピュータグラフィックス|分B10中 | | 13 |
||||||
|
コンピュータプログラマー |人Z01下 | | 12 |
||||||
|
(3 rows) |
||||||
|
|
||||||
|
QUERY: select *,octet_length(用語) from 計算機用語; |
||||||
|
用語 |分類コード|備考1aだよ|octet_length |
||||||
|
---------------------------------------+---------------+--------------+------------ |
||||||
|
コンピュータディスプレイ |機A01上 | | 36 |
||||||
|
コンピュータグラフィックス|分B10中 | | 39 |
||||||
|
コンピュータプログラマー |人Z01下 | | 36 |
||||||
|
(3 rows) |
||||||
|
|
||||||
|
QUERY: select *,position('デ' in 用語) from 計算機用語; |
||||||
|
用語 |分類コード|備考1aだよ|strpos |
||||||
|
---------------------------------------+---------------+--------------+------ |
||||||
|
コンピュータディスプレイ |機A01上 | | 7 |
||||||
|
コンピュータグラフィックス|分B10中 | | 0 |
||||||
|
コンピュータプログラマー |人Z01下 | | 0 |
||||||
|
(3 rows) |
||||||
|
|
||||||
|
QUERY: select *,substring(用語 from 10 for 4) from 計算機用語; |
||||||
|
用語 |分類コード|備考1aだよ|substr |
||||||
|
---------------------------------------+---------------+--------------+------------ |
||||||
|
コンピュータディスプレイ |機A01上 | |プレイ |
||||||
|
コンピュータグラフィックス|分B10中 | |ィックス |
||||||
|
コンピュータプログラマー |人Z01下 | |ラマー |
||||||
|
(3 rows) |
||||||
|
|
@ -0,0 +1,48 @@ |
|||||||
|
#! /bin/sh |
||||||
|
# $Header: /cvsroot/pgsql/src/test/mb/mbregress.sh,v 1.1 1998/07/24 03:32:40 scrappy Exp $ |
||||||
|
|
||||||
|
if echo '\c' | grep -s c >/dev/null 2>&1 |
||||||
|
then |
||||||
|
ECHO_N="echo -n" |
||||||
|
ECHO_C="" |
||||||
|
else |
||||||
|
ECHO_N="echo" |
||||||
|
ECHO_C='\c' |
||||||
|
fi |
||||||
|
|
||||||
|
PSQL="psql -n -e -q" |
||||||
|
tests="euc_jp sjis euc_kr euc_cn unicode mule_internal" |
||||||
|
unset PGCLIENTENCODING |
||||||
|
for i in $tests |
||||||
|
do |
||||||
|
$ECHO_N "${i} .. " $ECHO_C |
||||||
|
|
||||||
|
if [ $i = sjis ];then |
||||||
|
PGCLIENTENCODING=SJIS |
||||||
|
export PGCLIENTENCODING |
||||||
|
$PSQL euc_jp < sql/sjis.sql > results/sjis.out 2>&1 |
||||||
|
unset PGCLIENTENCODING |
||||||
|
else |
||||||
|
destroydb $i >/dev/null 2>&1 |
||||||
|
createdb -E `echo $i|tr "[a-z]" "[A-Z]"` $i |
||||||
|
$PSQL $i < sql/${i}.sql > results/${i}.out 2>&1 |
||||||
|
fi |
||||||
|
|
||||||
|
if [ -f expected/${i}-${SYSTEM}.out ] |
||||||
|
then |
||||||
|
EXPECTED="expected/${i}-${SYSTEM}.out" |
||||||
|
else |
||||||
|
EXPECTED="expected/${i}.out" |
||||||
|
fi |
||||||
|
|
||||||
|
if [ `diff ${EXPECTED} results/${i}.out | wc -l` -ne 0 ] |
||||||
|
then |
||||||
|
( diff -wC3 ${EXPECTED} results/${i}.out; \ |
||||||
|
echo ""; \ |
||||||
|
echo "----------------------"; \ |
||||||
|
echo "" ) >> regression.diffs |
||||||
|
echo failed |
||||||
|
else |
||||||
|
echo ok |
||||||
|
fi |
||||||
|
done |
@ -0,0 +1,19 @@ |
|||||||
|
drop table 计算机术语; |
||||||
|
create table 计算机术语(术语 text, 分类号 varchar, 备注1A char(16)); |
||||||
|
create index 计算机术语index1 on 计算机术语 using btree(术语); |
||||||
|
create index 计算机术语index2 on 计算机术语 using btree(分类号); |
||||||
|
insert into 计算机术语 values('电脑显示屏','机A01上'); |
||||||
|
insert into 计算机术语 values('电脑图形','分B01中'); |
||||||
|
insert into 计算机术语 values('电脑程序员','人Z01下'); |
||||||
|
vacuum 计算机术语; |
||||||
|
select * from 计算机术语; |
||||||
|
select * from 计算机术语 where 分类号 = '人Z01下'; |
||||||
|
select * from 计算机术语 where 分类号 ~* '人z01下'; |
||||||
|
select * from 计算机术语 where 分类号 like '_Z01_'; |
||||||
|
select * from 计算机术语 where 分类号 like '_Z%'; |
||||||
|
select * from 计算机术语 where 术语 ~ '电脑[显图]'; |
||||||
|
select * from 计算机术语 where 术语 ~* '电脑[显图]'; |
||||||
|
select *,character_length(术语) from 计算机术语; |
||||||
|
select *,octet_length(术语) from 计算机术语; |
||||||
|
select *,position('显' in 术语) from 计算机术语; |
||||||
|
select *,substring(术语 from 3 for 4) from 计算机术语; |
@ -0,0 +1,19 @@ |
|||||||
|
drop table 計算機用語; |
||||||
|
create table 計算機用語 (用語 text, 分類コード varchar, 備考1Aだよ char(16)); |
||||||
|
create index 計算機用語index1 on 計算機用語 using btree (用語); |
||||||
|
create index 計算機用語index2 on 計算機用語 using hash (分類コード); |
||||||
|
insert into 計算機用語 values('コンピュータディスプレイ','機A01上'); |
||||||
|
insert into 計算機用語 values('コンピュータグラフィックス','分B10中'); |
||||||
|
insert into 計算機用語 values('コンピュータプログラマー','人Z01下'); |
||||||
|
vacuum 計算機用語; |
||||||
|
select * from 計算機用語; |
||||||
|
select * from 計算機用語 where 分類コード = '人Z01下'; |
||||||
|
select * from 計算機用語 where 分類コード ~* '人z01下'; |
||||||
|
select * from 計算機用語 where 分類コード like '_Z01_'; |
||||||
|
select * from 計算機用語 where 分類コード like '_Z%'; |
||||||
|
select * from 計算機用語 where 用語 ~ 'コンピュータ[デグ]'; |
||||||
|
select * from 計算機用語 where 用語 ~* 'コンピュータ[デグ]'; |
||||||
|
select *,character_length(用語) from 計算機用語; |
||||||
|
select *,octet_length(用語) from 計算機用語; |
||||||
|
select *,position('デ' in 用語) from 計算機用語; |
||||||
|
select *,substring(用語 from 10 for 4) from 計算機用語; |
@ -0,0 +1,19 @@ |
|||||||
|
drop table 計算機용어; |
||||||
|
create table 計算機용어 (용어 text, 分類코드 varchar, 비고1A라구 char(16)); |
||||||
|
create index 計算機용어index1 on 計算機용어 using btree (용어); |
||||||
|
create index 計算機용어index2 on 計算機용어 using hash (分類코드); |
||||||
|
insert into 計算機용어 values('컴퓨터디스플레이', '機A01上'); |
||||||
|
insert into 計算機용어 values('컴퓨터그래픽스', '分B10中'); |
||||||
|
insert into 計算機용어 values('컴퓨터프로그래머', '人Z01下'); |
||||||
|
vacuum 計算機용어; |
||||||
|
select * from 計算機용어; |
||||||
|
select * from 計算機용어 where 分類코드 = '人Z01下'; |
||||||
|
select * from 計算機용어 where 分類코드 ~* '人z01下'; |
||||||
|
select * from 計算機용어 where 分類코드 like '_Z01_'; |
||||||
|
select * from 計算機용어 where 分類코드 like '_Z%'; |
||||||
|
select * from 計算機용어 where 용어 ~ '컴퓨터[디그]'; |
||||||
|
select * from 計算機용어 where 용어 ~* '컴퓨터[디그]'; |
||||||
|
select *,character_length(용어) from 計算機용어; |
||||||
|
select *,octet_length(용어) from 計算機용어; |
||||||
|
select *,position('디' in 용어) from 計算機용어; |
||||||
|
select *,substring(용어 from 3 for 4) from 計算機용어; |
@ -0,0 +1,20 @@ |
|||||||
|
drop table 計算機用語; |
||||||
|
create table 計算機用語 (用語 text, 分類コード varchar, 備考1Aだよ char(16)); |
||||||
|
create index 計算機用語index1 on 計算機用語 using btree (用語); |
||||||
|
create index 計算機用語index2 on 計算機用語 using hash (分類コード); |
||||||
|
insert into 計算機用語 values('コンピュータディスプレイ','機A01上'); |
||||||
|
insert into 計算機用語 values('コンピュータグラフィックス','分B10中'); |
||||||
|
insert into 計算機用語 values('コンピュータプログラマー','人Z01下'); |
||||||
|
vacuum 計算機用語; |
||||||
|
select * from 計算機用語; |
||||||
|
select * from 計算機用語 where 分類コード = '人Z01下'; |
||||||
|
select * from 計算機用語 where 分類コード ~* '人z01下'; |
||||||
|
select * from 計算機用語 where 分類コード like '_Z01_'; |
||||||
|
select * from 計算機用語 where 分類コード like '_Z%'; |
||||||
|
select * from 計算機用語 where 用語 ~ 'コンピュータ[デグ]'; |
||||||
|
select * from 計算機用語 where 用語 ~* 'コンピュータ[デグ]'; |
||||||
|
select *,character_length(用語) from 計算機用語; |
||||||
|
select *,octet_length(用語) from 計算機用語; |
||||||
|
select *,position('デ' in 用語) from 計算機用語; |
||||||
|
select *,substring(用語 from 10 for 4) from 計算機用語; |
||||||
|
copy 計算機用語 to stdout; |
@ -0,0 +1,19 @@ |
|||||||
|
drop table 計算機用語; |
||||||
|
create table 計算機用語 (用語 text, 分類コード varchar, 備考1Aだよ char(16)); |
||||||
|
create index 計算機用語index1 on 計算機用語 using btree (用語); |
||||||
|
create index 計算機用語index2 on 計算機用語 using hash (分類コード); |
||||||
|
insert into 計算機用語 values('コンピュータディスプレイ','機A01上'); |
||||||
|
insert into 計算機用語 values('コンピュータグラフィックス','分B10中'); |
||||||
|
insert into 計算機用語 values('コンピュータプログラマー','人Z01下'); |
||||||
|
vacuum 計算機用語; |
||||||
|
select * from 計算機用語; |
||||||
|
select * from 計算機用語 where 分類コード = '人Z01下'; |
||||||
|
select * from 計算機用語 where 分類コード ~* '人z01下'; |
||||||
|
select * from 計算機用語 where 分類コード like '_Z01_'; |
||||||
|
select * from 計算機用語 where 分類コード like '_Z%'; |
||||||
|
select * from 計算機用語 where 用語 ~ 'コンピュータ[デグ]'; |
||||||
|
select * from 計算機用語 where 用語 ~* 'コンピュータ[デグ]'; |
||||||
|
select *,character_length(用語) from 計算機用語; |
||||||
|
select *,octet_length(用語) from 計算機用語; |
||||||
|
select *,position('デ' in 用語) from 計算機用語; |
||||||
|
select *,substring(用語 from 10 for 4) from 計算機用語; |
Loading…
Reference in new issue