提交 7ea8403c 编写于 作者: B Bruce Momjian

The beos port in the source tree doesn't even compile. and even

after that dynamic loading isn't working and shared memory handling is
broken.

        Attached with this message, there is a Zip file which contain :

        * beos.diff = patch file generated with difforig
        * beos = folder with beos support files which need to be moved in /
src/backend/port
        * expected = foler with three file for message and precision
difference in regression test
        * regression.diff = rule problem (need to kill the backend manualy)
        * dynloader = dynloader files (they are also in the pacth files,
but there is so much modification that I have join full files)

        Everything works except a problem in 'rules' Is there some problems
with rules in the current tree ? It used to works with last week tree.

Cyril VELTER
上级 a7594601
......@@ -82,6 +82,7 @@ nextstep*) template=nextstep ;;
sysv4*) template=svr4 ;;
sysv5uw*) template=unixware ;;
ultrix*) template=ultrix4 ;;
beos*) template=beos ;;
esac
if test x"$template" = x"" ; then
......
......@@ -6,7 +6,7 @@
# Copyright (c) 1998, Regents of the University of California
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/Makefile.shlib,v 1.23 2000/09/17 13:02:29 petere Exp $
# $Header: /cvsroot/pgsql/src/Makefile.shlib,v 1.24 2000/10/07 14:39:06 momjian Exp $
#
#-------------------------------------------------------------------------
......@@ -198,6 +198,11 @@ ifeq ($(PORTNAME), win)
shlib := $(NAME)$(DLSUFFIX)
endif
ifeq ($(PORTNAME), beos)
install-shlib-dep := install-shlib
shlib := lib$(NAME)$(DLSUFFIX)
LDFLAGS_SL := -nostart -ltermcap -lstdc++.r4 -lbind -lsocket -L/boot/develop/lib/x86
endif
# Note that in what follows, shlib is empty when not building a shared
# library.
......@@ -225,6 +230,7 @@ endif
endif # not win
ifdef shlib
ifneq ($(PORTNAME), beos)
ifneq ($(PORTNAME), win)
ifneq ($(PORTNAME), aix)
......@@ -263,6 +269,15 @@ $(top_builddir)/src/utils/dllinit.o: $(top_srcdir)/src/utils/dllinit.c
$(MAKE) -C $(top_builddir)/src/utils dllinit.o
endif # PORTNAME == win
else # PORTNAME == beos
# BEOS case
$(shlib): $(OBJS)
ln -fs $(top_srcdir)/src/backend/postgres _APP_
$(CC) -Xlinker -soname=$@ $(LDFLAGS_SL) -o $@ _APP_ $(OBJS) $(SHLIB_LINK)
endif # PORTNAME == beos
endif # shlib
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/main/main.c,v 1.31 2000/10/03 03:11:15 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/main/main.c,v 1.32 2000/10/07 14:39:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -98,6 +98,12 @@ if (!geteuid())
}
#endif /* __BEOS__ */
#ifdef __BEOS__
/* Specific beos actions on startup */
beos_startup(argc,argv);
#endif
if (len >= 10 && !strcmp(argv[0] + len - 10, "postmaster"))
exit(PostmasterMain(argc, argv));
......
......@@ -13,7 +13,7 @@
# be converted to Method 2.
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/port/Attic/Makefile.in,v 1.24 2000/08/31 16:10:16 petere Exp $
# $Header: /cvsroot/pgsql/src/backend/port/Attic/Makefile.in,v 1.25 2000/10/07 14:39:10 momjian Exp $
#
#-------------------------------------------------------------------------
......@@ -27,6 +27,9 @@ OBJS+= @STRTOL@ @STRTOUL@ @SNPRINTF@
ifeq ($(PORTNAME), qnx4)
OBJS += getrusage.o qnx4/SUBSYS.o
endif
ifeq ($(PORTNAME), beos)
OBJS += beos/SUBSYS.o
endif
all: SUBSYS.o
SUBSYS.o: $(OBJS)
......@@ -37,6 +40,9 @@ qnx4/SUBSYS.o: qnx4.dir
qnx4.dir:
$(MAKE) -C qnx4 all
beos/SUBSYS.o:
$(MAKE) -C beos all
tas.o: tas.s
$(CC) $(CFLAGS) -c tas.s
......
......@@ -8,53 +8,65 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/port/dynloader/Attic/beos.c,v 1.2 2000/10/03 03:11:15 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/port/dynloader/Attic/beos.c,v 1.3 2000/10/07 14:39:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include <kernel/OS.h>
#include <image.h>
#include <errno.h>
#include "utils/dynamic_loader.h"
#include "utils/elog.h"
#include "dynloader.h"
extern char pg_pathname[];
void *
beos_dlopen(const char *filename)
void *
pg_dlopen(char *filename)
{
image_id id = -1;
image_id* im;
/* Handle memory allocation to store the Id of the shared object*/
im=(image_id*)(malloc(sizeof(image_id)));
/* Add-on loading */
*im=beos_dl_open(filename);
return im;
}
if ((id = load_add_on(filename)) < 0)
return NULL;
return (void *) id;
char *
pg_dlerror()
{
static char errmsg[] = "Load Add-On failed";
return errmsg;
}
void
beos_dlclose(void *handle)
PGFunction
pg_dlsym(void *handle, char *funcname)
{
image_id id = (image_id) handle;
unload_add_on(id);
return;
PGFunction fpt;
/* Checking that "Handle" is valid */
if ((handle) && ((*(int*)(handle))>=0))
{
/* Loading symbol */
if(get_image_symbol(*((int*)(handle)),funcname,B_SYMBOL_TYPE_TEXT,(void**)&fpt)==B_OK);
{
return fpt;
}
elog(NOTICE, "loading symbol '%s' failed ",funcname);
}
elog(NOTICE, "add-on not loaded correctly");
return NULL;
}
void *
beos_dlsym(void *handle, const char *name)
{
image_id id = (image_id)handle;
void *addr;
if (get_image_symbol(id, name, B_SYMBOL_TYPE_ANY, &addr) != B_OK)
return NULL;
return addr;
}
char *
beos_dlerror()
void
pg_dlclose(void *handle)
{
return (char *)strerror(errno);
}
/* Checking that "Handle" is valid */
if ((handle) && ((*(int*)(handle))>=0))
{
if (beos_dl_close(*(image_id*)handle)!=B_OK)
elog(NOTICE, "error while unloading add-on");
free(handle);
}
}
\ No newline at end of file
......@@ -7,27 +7,12 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: beos.h,v 1.2 2000/10/03 03:11:15 momjian Exp $
* $Id: beos.h,v 1.3 2000/10/07 14:39:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef PORT_PROTOS_H
#define PORT_PROTOS_H
#include "postgres.h"
#include "fmgr.h"
#include "utils/dynamic_loader.h"
char *beos_dlerror(void);
void *beos_dlopen(const char *filename);
void *beos_dlsym(void *handle, const char *name);
void beos_dlclose(void *handle);
#define pg_dlopen(f) beos_dlopen(f)
#define pg_dlsym beos_dlsym
#define pg_dlclose beos_dlclose
#define pg_dlerror beos_dlerror
#endif /* PORT_PROTOS_H */
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipc.c,v 1.51 2000/10/03 03:11:17 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipc.c,v 1.52 2000/10/07 14:39:12 momjian Exp $
*
* NOTES
*
......@@ -243,17 +243,12 @@ on_exit_reset(void)
static void
IPCPrivateSemaphoreKill(int status, int semId)
{
/* BeOS has a native sempahore type... */
#ifndef __BEOS__
union semun semun;
semun.val = 0; /* unused */
if (semctl(semId, 0, IPC_RMID, semun) == -1)
elog(NOTICE, "IPCPrivateSemaphoreKill: semctl(%d, 0, IPC_RMID, ...) failed: %s",
semId, strerror(errno));
#else /* __BEOS__ */
delete_sem(semId);
#endif /* __BEOS__ */
}
......@@ -270,18 +265,11 @@ IPCPrivateMemoryKill(int status, int shmId)
}
else
{
#ifndef __BEOS__
if (shmctl(shmId, IPC_RMID, (struct shmid_ds *) NULL) < 0)
{
elog(NOTICE, "IPCPrivateMemoryKill: shmctl(%d, %d, 0) failed: %m",
shmId, IPC_RMID);
}
#else
if (delete_area(shmId) != B_OK)
{
elog(NOTICE, "IPCPrivateMemoryKill: delete_area(%d) failed", shmId);
}
#endif /* __BEOS__ */
}
}
......@@ -304,7 +292,6 @@ IpcSemaphoreCreate(IpcSemaphoreKey semKey,
int removeOnExit)
{
int semId;
#ifndef __BEOS__
int i;
int errStatus;
u_short array[IPC_NMAXSEM];
......@@ -366,21 +353,6 @@ IpcSemaphoreCreate(IpcSemaphoreKey semKey,
}
#else /* BeOS implementation */
char semname[32];
sprintf (semname, "pgsql_ipc:%ld", semKey);
semId = create_sem(1, semname);
if (semId < 0) {
fprintf(stderr, "IpcSemaphoreCreate: create_sem(1, %s) failed: %s\n",
semname, strerror(errno));
return (-1);
}
if (removeOnExit)
on_shmem_exit(IPCPrivateSemaphoreKill, (caddr_t) semId);
#endif
#ifdef DEBUG_IPC
fprintf(stderr, "IpcSemaphoreCreate returns %d\n", semId);
fflush(stdout);
......@@ -424,7 +396,6 @@ void
IpcSemaphoreKill(IpcSemaphoreKey key)
{
int semId;
#ifndef __BEOS__
union semun semun;
semun.val = 0; /* unused */
......@@ -433,23 +404,6 @@ IpcSemaphoreKill(IpcSemaphoreKey key)
semId = semget(key, 0, 0);
if (semId != -1)
semctl(semId, 0, IPC_RMID, semun);
#else
/* first find the semId by looking at sempahore names... */
sem_info si;
int32 cookie = 0;
char semname[32];
sprintf(semname, "pgsql_ipc:%ld", key);
semId = -1;
while (get_next_sem_info(0, &cookie, &si) == B_OK) {
if (strcmp(si.name, semname) == 0){
semId = si.sem;
break;
}
}
if (semId != -1)
delete_sem(semId);
#endif
}
/****************************************************************************/
......@@ -462,7 +416,6 @@ static int IpcSemaphoreLock_return;
void
IpcSemaphoreLock(IpcSemaphoreId semId, int sem, int lock)
{
#ifndef __BEOS__
extern int errno;
int errStatus;
struct sembuf sops;
......@@ -495,13 +448,6 @@ IpcSemaphoreLock(IpcSemaphoreId semId, int sem, int lock)
semId, strerror(errno));
proc_exit(255);
}
#else
if ((IpcSemaphoreLock_return = acquire_sem(semId)) != B_NO_ERROR) {
fprintf(stderr, "IpcSempahoreLock: acquire_sem failed on sem_id %d: %s\n",
semId, strerror(errno));
proc_exit(255);
}
#endif
}
/****************************************************************************/
......@@ -514,7 +460,6 @@ static int IpcSemaphoreUnlock_return;
void
IpcSemaphoreUnlock(IpcSemaphoreId semId, int sem, int lock)
{
#ifndef __BEOS__
extern int errno;
int errStatus;
struct sembuf sops;
......@@ -548,49 +493,28 @@ IpcSemaphoreUnlock(IpcSemaphoreId semId, int sem, int lock)
semId, strerror(errno));
proc_exit(255);
}
#else
if ((IpcSemaphoreUnlock_return = release_sem(semId)) != B_NO_ERROR) {
fprintf(stderr, "IpcSempahoreUnlock: release_sem failed on sem_id %d: %s\n",
semId, strerror(errno));
proc_exit(255);
}
#endif
}
int
IpcSemaphoreGetCount(IpcSemaphoreId semId, int sem)
{
#ifndef __BEOS__
int semncnt;
union semun dummy; /* for Solaris */
dummy.val = 0; /* unused */
semncnt = semctl(semId, sem, GETNCNT, dummy);
return semncnt;
#else
sem_info si;
get_sem_info(semId, &si);
return si.count;
#endif /* __BEOS__ */
}
int
IpcSemaphoreGetValue(IpcSemaphoreId semId, int sem)
{
#ifndef __BEOS__
int semval;
union semun dummy; /* for Solaris */
dummy.val = 0; /* unused */
semval = semctl(semId, sem, GETVAL, dummy);
return semval;
#else
sem_info si;
get_sem_info(semId, &si);
return si.count;
#endif /* __BEOS__ */
}
/****************************************************************************/
......@@ -611,7 +535,6 @@ IpcMemoryCreate(IpcMemoryKey memKey, uint32 size, int permission)
shmid = PrivateMemoryCreate(memKey, size);
}
else
#ifndef __BEOS__
shmid = shmget(memKey, size, IPC_CREAT | permission);
......@@ -649,24 +572,6 @@ IpcMemoryCreate(IpcMemoryKey memKey, uint32 size, int permission)
return IpcMemCreationFailed;
}
#else
{
char *addr;
uint32 pages = ((size - 1) / B_PAGE_SIZE) +1;
char areaname[32];
sprintf (areaname, "pgsql_ipc%ld", memKey);
shmid = create_area(areaname, (void*)&addr, B_ANY_ADDRESS, pages * B_PAGE_SIZE,
B_NO_LOCK, B_READ_AREA|B_WRITE_AREA);
}
if (shmid < 0) {
fprintf(stderr, "IpcMemoryCreate: failed: %s\n",
strerror(errno));
return IpcMemCreationFailed;
}
#endif /* __BEOS__ */
/* if (memKey == PrivateIPCKey) */
on_shmem_exit(IPCPrivateMemoryKill, (Datum) shmid);
......@@ -683,7 +588,6 @@ IpcMemoryIdGet(IpcMemoryKey memKey, uint32 size)
{
IpcMemoryId shmid;
#ifndef __BEOS__
shmid = shmget(memKey, size, 0);
if (shmid < 0)
......@@ -692,17 +596,6 @@ IpcMemoryIdGet(IpcMemoryKey memKey, uint32 size)
memKey, size, strerror(errno));
return IpcMemIdGetFailed;
}
#else
char areaname[32];
sprintf(areaname, "pgsql_ipc%ld", memKey);
shmid = find_area(areaname);
if (shmid == B_NAME_NOT_FOUND){
fprintf(stderr, "IpcMemoryIdGet: find_area(%s) failed: %s\n",
areaname, strerror(errno));
return IpcMemIdGetFailed;
}
#endif /* __BEOS__ */
return shmid;
}
......@@ -715,10 +608,8 @@ IpcMemoryIdGet(IpcMemoryKey memKey, uint32 size)
static void
IpcMemoryDetach(int status, char *shmaddr)
{
#ifndef __BEOS__
if (shmdt(shmaddr) < 0)
elog(NOTICE, "IpcMemoryDetach: shmdt(0x%p) failed: %m", shmaddr);
#endif
}
/****************************************************************************/
......@@ -733,7 +624,6 @@ IpcMemoryAttach(IpcMemoryId memId)
{
char *memAddress;
#ifndef __BEOS__
if (UsePrivateMemory)
memAddress = (char *) PrivateMemoryAttach(memId);
else
......@@ -746,23 +636,6 @@ IpcMemoryAttach(IpcMemoryId memId)
memId, strerror(errno));
return IpcMemAttachFailed;
}
#else
if (UsePrivateMemory)
memAddress = (char *) PrivateMemoryAttach(memId);
else
{
area_info ai;
get_area_info(memId, &ai);
memAddress = (char *)ai.address;
}
if (memAddress == (char *)-1) {
fprintf(stderr,"IpcMemoryAttach: failed to get area address (%d): %s\n",
memId, strerror(errno));
return IpcMemAttachFailed;
}
#endif /* __BEOS__ */
if (!UsePrivateMemory)
on_shmem_exit(IpcMemoryDetach, PointerGetDatum(memAddress));
......@@ -780,7 +653,6 @@ IpcMemoryKill(IpcMemoryKey memKey)
{
IpcMemoryId shmid;
#ifndef __BEOS__
if (!UsePrivateMemory && (shmid = shmget(memKey, 0, 0)) >= 0)
{
if (shmctl(shmid, IPC_RMID, (struct shmid_ds *) NULL) < 0)
......@@ -789,15 +661,6 @@ IpcMemoryKill(IpcMemoryKey memKey)
shmid, IPC_RMID);
}
}
#else
char areaname[32];
sprintf(areaname, "pgsql_ipc%ld", memKey);
shmid = find_area(areaname);
if (!UsePrivateMemory && shmid > 0) {
if (delete_area(shmid) != B_OK)
elog(NOTICE, "IpcMemoryKill: deleta_area(%d) failed!", shmid);
}
#endif /* __BEOS__ */
}
#ifdef HAS_TEST_AND_SET
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.82 2000/10/03 03:11:18 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.83 2000/10/07 14:39:13 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -47,7 +47,7 @@
* This is so that we can support more backends. (system-wide semaphore
* sets run out pretty fast.) -ay 4/95
*
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.82 2000/10/03 03:11:18 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.83 2000/10/07 14:39:13 momjian Exp $
*/
#include "postgres.h"
......@@ -266,10 +266,8 @@ InitProcess(IPCKey key)
* we might be reusing a semaphore that belongs to a dead backend.
* So be careful and reinitialize its value here.
*/
#ifndef __BEOS__
semun.val = IpcSemaphoreDefaultStartValue;
semctl(semId, semNum, SETVAL, semun);
#endif
IpcSemaphoreLock(semId, semNum, IpcExclusiveLock);
MyProc->sem.semId = semId;
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.179 2000/10/07 04:00:41 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.180 2000/10/07 14:39:14 momjian Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
......@@ -1462,6 +1462,11 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
if (IsUnderPostmaster)
{
#ifdef __BEOS__
/* Specific beos backend stratup actions */
beos_backend_startup(argv[0]);
#endif
/* noninteractive case: nothing should be left after switches */
if (errs || argc != optind || DBName == NULL)
{
......@@ -1613,7 +1618,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
if (!IsUnderPostmaster)
{
puts("\nPOSTGRES backend interactive interface ");
puts("$Revision: 1.179 $ $Date: 2000/10/07 04:00:41 $\n");
puts("$Revision: 1.180 $ $Date: 2000/10/07 14:39:14 $\n");
}
/*
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.63 2000/10/03 03:11:21 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.64 2000/10/07 14:39:14 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -144,6 +144,9 @@ elog(int lev, const char *fmt, ...)
sprintf(errorstr_buf, "error %d", errno);
errorstr = errorstr_buf;
}
#else
errorstr = strerror(errno);
#endif /* __BEOS__ */
if (lev == ERROR || lev == FATAL)
{
......@@ -182,9 +185,6 @@ elog(int lev, const char *fmt, ...)
prefix = prefix_buf;
break;
}
#else
errorstr = strerror(errno);
#endif /* __BEOS__ */
timestamp_size = 0;
if (Log_timestamp)
......
......@@ -6,7 +6,7 @@
*
* Copyright (C) 2000 by PostgreSQL Global Development Group
*
* $Header: /cvsroot/pgsql/src/bin/pg_id/Attic/pg_id.c,v 1.15 2000/05/29 21:26:04 momjian Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_id/Attic/pg_id.c,v 1.16 2000/10/07 14:39:15 momjian Exp $
*/
#include "postgres.h"
......@@ -89,6 +89,11 @@ main(int argc, char *argv[])
else if (nameflag)
puts(pw->pw_name);
else
#ifdef __BEOS__
if (pw->pw_uid==0)
printf("1\n");
else
#endif
printf("%d\n", (int) pw->pw_uid);
return 0;
......
......@@ -8,7 +8,7 @@
* or in config.h afterwards. Of course, if you edit config.h, then your
* changes will be overwritten the next time you run configure.
*
* $Id: config.h.in,v 1.140 2000/10/03 19:50:21 petere Exp $
* $Id: config.h.in,v 1.141 2000/10/07 14:39:16 momjian Exp $
*/
#ifndef CONFIG_H
......@@ -227,7 +227,7 @@
* Define this is your operating system kernel supports AF_UNIX family
* sockets.
*/
#if !defined(__CYGWIN__) && !defined(__QNX__)
#if !defined(__CYGWIN__) && !defined(__QNX__) && !defined(__BEOS__)
# define HAVE_UNIX_SOCKETS 1
#endif
......
......@@ -6,4 +6,68 @@ typedef unsigned char slock_t;
#define AF_UNIX 1 /* no domain sockets on BeOS */
#ifdef __cplusplus
extern "C" {
#endif
#include "kernel/image.h"
#undef HAVE_UNION_SEMUN
#define HAVE_UNION_SEMUN 1
#undef HAVE_SYS_SEM_H
#undef HAVE_SYS_SHM_H
union semun
{
int val;
struct semid_ds *buf;
unsigned short *array;
};
/* SYS V emulation */
#define IPC_RMID 256
#define IPC_CREAT 512
#define IPC_EXCL 1024
#define IPC_PRIVATE 234564
#define EACCESS 2048
#define EIDRM 4096
#define SETALL 8192
#define GETNCNT 16384
#define GETVAL 65536
#define SETVAL 131072
struct sembuf
{
int sem_flg;
int sem_op;
int sem_num;
};
int semctl(int semId,int semNum,int flag,union semun);
int semget(int semKey, int semNum, int flags);
int semop(int semId, struct sembuf *sops, int flag);
struct shmid_ds
{
int dummy;
};
int shmdt(char* shmaddr);
int* shmat(int memId,int m1,int m2);
int shmctl(int shmid,int flag, struct shmid_ds* dummy);
int shmget(int memKey,int size,int flag);
/* Support functions */
/* Specific beos action made on postgres/postmaster startup */
void beos_startup(int argc,char** argv);
/* Load a shared library */
image_id beos_dl_open(char * filename);
/* UnLoad a shared library */
status_t beos_dl_close(image_id im);
/* Specific beos action made on backend startup */
void beos_backend_startup(char* binary);
#ifdef __cplusplus
}
#endif
\ No newline at end of file
......@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: ipc.h,v 1.41 2000/10/03 03:11:24 momjian Exp $
* $Id: ipc.h,v 1.42 2000/10/07 14:39:17 momjian Exp $
*
* NOTES
* This file is very architecture-specific. This stuff should actually
......@@ -27,11 +27,6 @@
#include <sys/types.h>
#ifdef HAVE_SYS_IPC_H
#include <sys/ipc.h> /* For IPC_PRIVATE */
#else
/* BeOS doesn't have IPC_PRIVATE so we'll use the value that is set by
* FreeBSD (1)
*/
#define IPC_PRIVATE 1
#endif /* HAVE_SYS_IPC_H */
#include "config.h"
......
MK_NO_LORDER=true
ifdef ELF_SYSTEM
LDFLAGS += -Wl,-E
CPPFLAGS+= -I$(top_srcdir)/src/backend/port/beos
endif
%.so: %.o
$(LD) -x -Bshareable -o $@ $<
ln -fs $(top_srcdir)/src/backend/postgres _APP_
$(CC) -nostart -Xlinker -soname=$@ -o $@ _APP_ $<
AROPT:crs
SHARED_LIB:-fpic -DPIC
CFLAGS:-O2
SRCH_INC:
SRCH_LIB:
USE_LOCALE:no
DLSUFFIX:.so
YFLAGS:-d
YACC:bison -y
AROPT=crs
SHARED_LIB='-fpic -DPIC'
CFLAGS='-O2'
LDFLAGS='-lbind'
SRCH_INC='/boot/apps/GeekGadgets/include'
SRCH_LIB='/boot/apps/GeekGadgets/lib'
USE_LOCALE=no
DLSUFFIX=.so
YFLAGS=-d
YACC='bison -y'
此差异已折叠。
--
-- INT2
-- NOTE: int2 operators never check for over/underflow!
-- Some of these answers are consequently numerically incorrect.
--
CREATE TABLE INT2_TBL(f1 int2);
INSERT INTO INT2_TBL(f1) VALUES ('0');
INSERT INTO INT2_TBL(f1) VALUES ('1234');
INSERT INTO INT2_TBL(f1) VALUES ('-1234');
INSERT INTO INT2_TBL(f1) VALUES ('34.5');
ERROR: pg_atoi: error in "34.5": can't parse ".5"
-- largest and smallest values
INSERT INTO INT2_TBL(f1) VALUES ('32767');
INSERT INTO INT2_TBL(f1) VALUES ('-32767');
-- bad input values -- should give warnings
INSERT INTO INT2_TBL(f1) VALUES ('100000');
ERROR: pg_atoi: error reading "100000": Range Error
INSERT INTO INT2_TBL(f1) VALUES ('asdf');
ERROR: pg_atoi: error in "asdf": can't parse "asdf"
SELECT '' AS five, INT2_TBL.*;
five | f1
------+--------
| 0
| 1234
| -1234
| 32767
| -32767
(5 rows)
SELECT '' AS four, i.* FROM INT2_TBL i WHERE i.f1 <> int2 '0';
four | f1
------+--------
| 1234
| -1234
| 32767
| -32767
(4 rows)
SELECT '' AS four, i.* FROM INT2_TBL i WHERE i.f1 <> int4 '0';
four | f1
------+--------
| 1234
| -1234
| 32767
| -32767
(4 rows)
SELECT '' AS one, i.* FROM INT2_TBL i WHERE i.f1 = int2 '0';
one | f1
-----+----
| 0
(1 row)
SELECT '' AS one, i.* FROM INT2_TBL i WHERE i.f1 = int4 '0';
one | f1
-----+----
| 0
(1 row)
SELECT '' AS two, i.* FROM INT2_TBL i WHERE i.f1 < int2 '0';
two | f1
-----+--------
| -1234
| -32767
(2 rows)
SELECT '' AS two, i.* FROM INT2_TBL i WHERE i.f1 < int4 '0';
two | f1
-----+--------
| -1234
| -32767
(2 rows)
SELECT '' AS three, i.* FROM INT2_TBL i WHERE i.f1 <= int2 '0';
three | f1
-------+--------
| 0
| -1234
| -32767
(3 rows)
SELECT '' AS three, i.* FROM INT2_TBL i WHERE i.f1 <= int4 '0';
three | f1
-------+--------
| 0
| -1234
| -32767
(3 rows)
SELECT '' AS two, i.* FROM INT2_TBL i WHERE i.f1 > int2 '0';
two | f1
-----+-------
| 1234
| 32767
(2 rows)
SELECT '' AS two, i.* FROM INT2_TBL i WHERE i.f1 > int4 '0';
two | f1
-----+-------
| 1234
| 32767
(2 rows)
SELECT '' AS three, i.* FROM INT2_TBL i WHERE i.f1 >= int2 '0';
three | f1
-------+-------
| 0
| 1234
| 32767
(3 rows)
SELECT '' AS three, i.* FROM INT2_TBL i WHERE i.f1 >= int4 '0';
three | f1
-------+-------
| 0
| 1234
| 32767
(3 rows)
-- positive odds
SELECT '' AS one, i.* FROM INT2_TBL i WHERE (i.f1 % int2 '2') = int2 '1';
one | f1
-----+-------
| 32767
(1 row)
-- any evens
SELECT '' AS three, i.* FROM INT2_TBL i WHERE (i.f1 % int4 '2') = int2 '0';
three | f1
-------+-------
| 0
| 1234
| -1234
(3 rows)
SELECT '' AS five, i.f1, i.f1 * int2 '2' AS x FROM INT2_TBL i;
five | f1 | x
------+--------+-------
| 0 | 0
| 1234 | 2468
| -1234 | -2468
| 32767 | -2
| -32767 | 2
(5 rows)
SELECT '' AS five, i.f1, i.f1 * int4 '2' AS x FROM INT2_TBL i;
five | f1 | x
------+--------+--------
| 0 | 0
| 1234 | 2468
| -1234 | -2468
| 32767 | 65534
| -32767 | -65534
(5 rows)
SELECT '' AS five, i.f1, i.f1 + int2 '2' AS x FROM INT2_TBL i;
five | f1 | x
------+--------+--------
| 0 | 2
| 1234 | 1236
| -1234 | -1232
| 32767 | -32767
| -32767 | -32765
(5 rows)
SELECT '' AS five, i.f1, i.f1 + int4 '2' AS x FROM INT2_TBL i;
five | f1 | x
------+--------+--------
| 0 | 2
| 1234 | 1236
| -1234 | -1232
| 32767 | 32769
| -32767 | -32765
(5 rows)
SELECT '' AS five, i.f1, i.f1 - int2 '2' AS x FROM INT2_TBL i;
five | f1 | x
------+--------+-------
| 0 | -2
| 1234 | 1232
| -1234 | -1236
| 32767 | 32765
| -32767 | 32767
(5 rows)
SELECT '' AS five, i.f1, i.f1 - int4 '2' AS x FROM INT2_TBL i;
five | f1 | x
------+--------+--------
| 0 | -2
| 1234 | 1232
| -1234 | -1236
| 32767 | 32765
| -32767 | -32769
(5 rows)
SELECT '' AS five, i.f1, i.f1 / int2 '2' AS x FROM INT2_TBL i;
five | f1 | x
------+--------+--------
| 0 | 0
| 1234 | 617
| -1234 | -617
| 32767 | 16383
| -32767 | -16383
(5 rows)
SELECT '' AS five, i.f1, i.f1 / int4 '2' AS x FROM INT2_TBL i;
five | f1 | x
------+--------+--------
| 0 | 0
| 1234 | 617
| -1234 | -617
| 32767 | 16383
| -32767 | -16383
(5 rows)
--
-- INT4
-- WARNING: int4 operators never check for over/underflow!
-- Some of these answers are consequently numerically incorrect.
--
CREATE TABLE INT4_TBL(f1 int4);
INSERT INTO INT4_TBL(f1) VALUES ('0');
INSERT INTO INT4_TBL(f1) VALUES ('123456');
INSERT INTO INT4_TBL(f1) VALUES ('-123456');
INSERT INTO INT4_TBL(f1) VALUES ('34.5');
ERROR: pg_atoi: error in "34.5": can't parse ".5"
-- largest and smallest values
INSERT INTO INT4_TBL(f1) VALUES ('2147483647');
INSERT INTO INT4_TBL(f1) VALUES ('-2147483647');
-- bad input values -- should give warnings
INSERT INTO INT4_TBL(f1) VALUES ('1000000000000');
ERROR: pg_atoi: error reading "1000000000000": Range Error
INSERT INTO INT4_TBL(f1) VALUES ('asdf');
ERROR: pg_atoi: error in "asdf": can't parse "asdf"
SELECT '' AS five, INT4_TBL.*;
five | f1
------+-------------
| 0
| 123456
| -123456
| 2147483647
| -2147483647
(5 rows)
SELECT '' AS four, i.* FROM INT4_TBL i WHERE i.f1 <> int2 '0';
four | f1
------+-------------
| 123456
| -123456
| 2147483647
| -2147483647
(4 rows)
SELECT '' AS four, i.* FROM INT4_TBL i WHERE i.f1 <> int4 '0';
four | f1
------+-------------
| 123456
| -123456
| 2147483647
| -2147483647
(4 rows)
SELECT '' AS one, i.* FROM INT4_TBL i WHERE i.f1 = int2 '0';
one | f1
-----+----
| 0
(1 row)
SELECT '' AS one, i.* FROM INT4_TBL i WHERE i.f1 = int4 '0';
one | f1
-----+----
| 0
(1 row)
SELECT '' AS two, i.* FROM INT4_TBL i WHERE i.f1 < int2 '0';
two | f1
-----+-------------
| -123456
| -2147483647
(2 rows)
SELECT '' AS two, i.* FROM INT4_TBL i WHERE i.f1 < int4 '0';
two | f1
-----+-------------
| -123456
| -2147483647
(2 rows)
SELECT '' AS three, i.* FROM INT4_TBL i WHERE i.f1 <= int2 '0';
three | f1
-------+-------------
| 0
| -123456
| -2147483647
(3 rows)
SELECT '' AS three, i.* FROM INT4_TBL i WHERE i.f1 <= int4 '0';
three | f1
-------+-------------
| 0
| -123456
| -2147483647
(3 rows)
SELECT '' AS two, i.* FROM INT4_TBL i WHERE i.f1 > int2 '0';
two | f1
-----+------------
| 123456
| 2147483647
(2 rows)
SELECT '' AS two, i.* FROM INT4_TBL i WHERE i.f1 > int4 '0';
two | f1
-----+------------
| 123456
| 2147483647
(2 rows)
SELECT '' AS three, i.* FROM INT4_TBL i WHERE i.f1 >= int2 '0';
three | f1
-------+------------
| 0
| 123456
| 2147483647
(3 rows)
SELECT '' AS three, i.* FROM INT4_TBL i WHERE i.f1 >= int4 '0';
three | f1
-------+------------
| 0
| 123456
| 2147483647
(3 rows)
-- positive odds
SELECT '' AS one, i.* FROM INT4_TBL i WHERE (i.f1 % int2 '2') = int2 '1';
one | f1
-----+------------
| 2147483647
(1 row)
-- any evens
SELECT '' AS three, i.* FROM INT4_TBL i WHERE (i.f1 % int4 '2') = int2 '0';
three | f1
-------+---------
| 0
| 123456
| -123456
(3 rows)
SELECT '' AS five, i.f1, i.f1 * int2 '2' AS x FROM INT4_TBL i;
five | f1 | x
------+-------------+---------
| 0 | 0
| 123456 | 246912
| -123456 | -246912
| 2147483647 | -2
| -2147483647 | 2
(5 rows)
SELECT '' AS five, i.f1, i.f1 * int4 '2' AS x FROM INT4_TBL i;
five | f1 | x
------+-------------+---------
| 0 | 0
| 123456 | 246912
| -123456 | -246912
| 2147483647 | -2
| -2147483647 | 2
(5 rows)
SELECT '' AS five, i.f1, i.f1 + int2 '2' AS x FROM INT4_TBL i;
five | f1 | x
------+-------------+-------------
| 0 | 2
| 123456 | 123458
| -123456 | -123454
| 2147483647 | -2147483647
| -2147483647 | -2147483645
(5 rows)
SELECT '' AS five, i.f1, i.f1 + int4 '2' AS x FROM INT4_TBL i;
five | f1 | x
------+-------------+-------------
| 0 | 2
| 123456 | 123458
| -123456 | -123454
| 2147483647 | -2147483647
| -2147483647 | -2147483645
(5 rows)
SELECT '' AS five, i.f1, i.f1 - int2 '2' AS x FROM INT4_TBL i;
five | f1 | x
------+-------------+------------
| 0 | -2
| 123456 | 123454
| -123456 | -123458
| 2147483647 | 2147483645
| -2147483647 | 2147483647
(5 rows)
SELECT '' AS five, i.f1, i.f1 - int4 '2' AS x FROM INT4_TBL i;
five | f1 | x
------+-------------+------------
| 0 | -2
| 123456 | 123454
| -123456 | -123458
| 2147483647 | 2147483645
| -2147483647 | 2147483647
(5 rows)
SELECT '' AS five, i.f1, i.f1 / int2 '2' AS x FROM INT4_TBL i;
five | f1 | x
------+-------------+-------------
| 0 | 0
| 123456 | 61728
| -123456 | -61728
| 2147483647 | 1073741823
| -2147483647 | -1073741823
(5 rows)
SELECT '' AS five, i.f1, i.f1 / int4 '2' AS x FROM INT4_TBL i;
five | f1 | x
------+-------------+-------------
| 0 | 0
| 123456 | 61728
| -123456 | -61728
| 2147483647 | 1073741823
| -2147483647 | -1073741823
(5 rows)
--
-- more complex expressions
--
-- variations on unary minus parsing
SELECT -2+3 AS one;
one
-----
1
(1 row)
SELECT 4-2 AS two;
two
-----
2
(1 row)
SELECT 2- -1 AS three;
three
-------
3
(1 row)
SELECT 2 - -2 AS four;
four
------
4
(1 row)
SELECT int2 '2' * int2 '2' = int2 '16' / int2 '4' AS true;
true
------
t
(1 row)
SELECT int4 '2' * int2 '2' = int2 '16' / int4 '4' AS true;
true
------
t
(1 row)
SELECT int2 '2' * int4 '2' = int4 '16' / int2 '4' AS true;
true
------
t
(1 row)
SELECT int4 '1000' < int4 '999' AS false;
false
-------
f
(1 row)
SELECT 4! AS twenty_four;
twenty_four
-------------
24
(1 row)
SELECT !!3 AS six;
six
-----
6
(1 row)
SELECT 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 AS ten;
ten
-----
10
(1 row)
SELECT 2 + 2 / 2 AS three;
three
-------
3
(1 row)
SELECT (2 + 2) / 2 AS two;
two
-----
2
(1 row)
......@@ -1084,179 +1084,8 @@ SELECT * FROM shoelace ORDER BY sl_name;
(8 rows)
insert into shoelace_ok select * from shoelace_arrive;
SELECT * FROM shoelace ORDER BY sl_name;
sl_name | sl_avail | sl_color | sl_len | sl_unit | sl_len_cm
------------+----------+------------+--------+----------+-----------
sl1 | 5 | black | 80 | cm | 80
sl2 | 6 | black | 100 | cm | 100
sl3 | 10 | black | 35 | inch | 88.9
sl4 | 8 | black | 40 | inch | 101.6
sl5 | 4 | brown | 1 | m | 100
sl6 | 20 | brown | 0.9 | m | 90
sl7 | 6 | brown | 60 | cm | 60
sl8 | 21 | brown | 40 | inch | 101.6
(8 rows)
SELECT * FROM shoelace_log ORDER BY sl_name;
sl_name | sl_avail | log_who | log_when
------------+----------+----------+----------
sl3 | 10 | Al Bundy | epoch
sl6 | 20 | Al Bundy | epoch
sl7 | 6 | Al Bundy | epoch
sl8 | 21 | Al Bundy | epoch
(4 rows)
CREATE VIEW shoelace_obsolete AS
SELECT * FROM shoelace WHERE NOT EXISTS
(SELECT shoename FROM shoe WHERE slcolor = sl_color);
CREATE VIEW shoelace_candelete AS
SELECT * FROM shoelace_obsolete WHERE sl_avail = 0;
insert into shoelace values ('sl9', 0, 'pink', 35.0, 'inch', 0.0);
insert into shoelace values ('sl10', 1000, 'magenta', 40.0, 'inch', 0.0);
SELECT * FROM shoelace_obsolete;
sl_name | sl_avail | sl_color | sl_len | sl_unit | sl_len_cm
------------+----------+------------+--------+----------+-----------
sl9 | 0 | pink | 35 | inch | 88.9
sl10 | 1000 | magenta | 40 | inch | 101.6
(2 rows)
SELECT * FROM shoelace_candelete;
sl_name | sl_avail | sl_color | sl_len | sl_unit | sl_len_cm
------------+----------+------------+--------+----------+-----------
sl9 | 0 | pink | 35 | inch | 88.9
(1 row)
DELETE FROM shoelace WHERE EXISTS
(SELECT * FROM shoelace_candelete
WHERE sl_name = shoelace.sl_name);
SELECT * FROM shoelace ORDER BY sl_name;
sl_name | sl_avail | sl_color | sl_len | sl_unit | sl_len_cm
------------+----------+------------+--------+----------+-----------
sl1 | 5 | black | 80 | cm | 80
sl10 | 1000 | magenta | 40 | inch | 101.6
sl2 | 6 | black | 100 | cm | 100
sl3 | 10 | black | 35 | inch | 88.9
sl4 | 8 | black | 40 | inch | 101.6
sl5 | 4 | brown | 1 | m | 100
sl6 | 20 | brown | 0.9 | m | 90
sl7 | 6 | brown | 60 | cm | 60
sl8 | 21 | brown | 40 | inch | 101.6
(9 rows)
SELECT * FROM shoe ORDER BY shoename;
shoename | sh_avail | slcolor | slminlen | slminlen_cm | slmaxlen | slmaxlen_cm | slunit
------------+----------+------------+----------+-------------+----------+-------------+----------
sh1 | 2 | black | 70 | 70 | 90 | 90 | cm
sh2 | 0 | black | 30 | 76.2 | 40 | 101.6 | inch
sh3 | 4 | brown | 50 | 50 | 65 | 65 | cm
sh4 | 3 | brown | 40 | 101.6 | 50 | 127 | inch
(4 rows)
SELECT count(*) FROM shoe;
count
-------
4
(1 row)
--
-- Simple test of qualified ON INSERT ... this did not work in 7.0 ...
--
create table foo (f1 int);
create table foo2 (f1 int);
create rule foorule as on insert to foo where f1 < 100
do instead nothing;
insert into foo values(1);
insert into foo values(1001);
select * from foo;
f1
------
1001
(1 row)
drop rule foorule;
-- this should fail because f1 is not exposed for unqualified reference:
create rule foorule as on insert to foo where f1 < 100
do instead insert into foo2 values (f1);
ERROR: Attribute 'f1' not found
-- this is the correct way:
create rule foorule as on insert to foo where f1 < 100
do instead insert into foo2 values (new.f1);
insert into foo values(2);
insert into foo values(100);
select * from foo;
f1
------
1001
100
(2 rows)
select * from foo2;
f1
----
2
(1 row)
drop rule foorule;
drop table foo;
drop table foo2;
--
-- Check that ruleutils are working
--
SELECT viewname, definition FROM pg_views ORDER BY viewname;
viewname | definition
--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
iexit | SELECT ih.name, ih.thepath, interpt_pp(ih.thepath, r.thepath) AS exit FROM ihighway ih, ramp r WHERE (ih.thepath ## r.thepath);
pg_indexes | SELECT c.relname AS tablename, i.relname AS indexname, pg_get_indexdef(x.indexrelid) AS indexdef FROM pg_index x, pg_class c, pg_class i WHERE ((c.oid = x.indrelid) AND (i.oid = x.indexrelid));
pg_rules | SELECT c.relname AS tablename, r.rulename, pg_get_ruledef(r.rulename) AS definition FROM pg_rewrite r, pg_class c WHERE ((r.rulename !~ '^_RET'::text) AND (c.oid = r.ev_class));
pg_tables | SELECT c.relname AS tablename, pg_get_userbyid(c.relowner) AS tableowner, c.relhasindex AS hasindexes, c.relhasrules AS hasrules, (c.reltriggers > 0) AS hastriggers FROM pg_class c WHERE (((c.relkind = 'r'::"char") OR (c.relkind = 's'::"char")) AND (NOT (EXISTS (SELECT pg_rewrite.rulename FROM pg_rewrite WHERE ((pg_rewrite.ev_class = c.oid) AND (pg_rewrite.ev_type = '1'::"char"))))));
pg_user | SELECT pg_shadow.usename, pg_shadow.usesysid, pg_shadow.usecreatedb, pg_shadow.usetrace, pg_shadow.usesuper, pg_shadow.usecatupd, '********'::text AS passwd, pg_shadow.valuntil FROM pg_shadow;
pg_views | SELECT c.relname AS viewname, pg_get_userbyid(c.relowner) AS viewowner, pg_get_viewdef(c.relname) AS definition FROM pg_class c WHERE (c.relhasrules AND (EXISTS (SELECT r.rulename FROM pg_rewrite r WHERE ((r.ev_class = c.oid) AND (r.ev_type = '1'::"char")))));
rtest_v1 | SELECT rtest_t1.a, rtest_t1.b FROM rtest_t1;
rtest_vcomp | SELECT x.part, (x.size * y.factor) AS size_in_cm FROM rtest_comp x, rtest_unitfact y WHERE (x.unit = y.unit);
rtest_vview1 | SELECT x.a, x.b FROM rtest_view1 x WHERE (0 < (SELECT count(*) AS count FROM rtest_view2 y WHERE (y.a = x.a)));
rtest_vview2 | SELECT rtest_view1.a, rtest_view1.b FROM rtest_view1 WHERE rtest_view1.v;
rtest_vview3 | SELECT x.a, x.b FROM rtest_vview2 x WHERE (0 < (SELECT count(*) AS count FROM rtest_view2 y WHERE (y.a = x.a)));
rtest_vview4 | SELECT x.a, x.b, count(y.a) AS refcount FROM rtest_view1 x, rtest_view2 y WHERE (x.a = y.a) GROUP BY x.a, x.b;
rtest_vview5 | SELECT rtest_view1.a, rtest_view1.b, rtest_viewfunc1(rtest_view1.a) AS refcount FROM rtest_view1;
shoe | SELECT sh.shoename, sh.sh_avail, sh.slcolor, sh.slminlen, (sh.slminlen * un.un_fact) AS slminlen_cm, sh.slmaxlen, (sh.slmaxlen * un.un_fact) AS slmaxlen_cm, sh.slunit FROM shoe_data sh, unit un WHERE (sh.slunit = un.un_name);
shoe_ready | SELECT rsh.shoename, rsh.sh_avail, rsl.sl_name, rsl.sl_avail, int4smaller(rsh.sh_avail, rsl.sl_avail) AS total_avail FROM shoe rsh, shoelace rsl WHERE (((rsl.sl_color = rsh.slcolor) AND (rsl.sl_len_cm >= rsh.slminlen_cm)) AND (rsl.sl_len_cm <= rsh.slmaxlen_cm));
shoelace | SELECT s.sl_name, s.sl_avail, s.sl_color, s.sl_len, s.sl_unit, (s.sl_len * u.un_fact) AS sl_len_cm FROM shoelace_data s, unit u WHERE (s.sl_unit = u.un_name);
shoelace_candelete | SELECT shoelace_obsolete.sl_name, shoelace_obsolete.sl_avail, shoelace_obsolete.sl_color, shoelace_obsolete.sl_len, shoelace_obsolete.sl_unit, shoelace_obsolete.sl_len_cm FROM shoelace_obsolete WHERE (shoelace_obsolete.sl_avail = 0);
shoelace_obsolete | SELECT shoelace.sl_name, shoelace.sl_avail, shoelace.sl_color, shoelace.sl_len, shoelace.sl_unit, shoelace.sl_len_cm FROM shoelace WHERE (NOT (EXISTS (SELECT shoe.shoename FROM shoe WHERE (shoe.slcolor = shoelace.sl_color))));
street | SELECT r.name, r.thepath, c.cname FROM ONLY road r, real_city c WHERE (c.outline ## r.thepath);
toyemp | SELECT emp.name, emp.age, emp."location", (12 * emp.salary) AS annualsal FROM emp;
(20 rows)
SELECT tablename, rulename, definition FROM pg_rules
ORDER BY tablename, rulename;
tablename | rulename | definition
---------------+-----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
rtest_emp | rtest_emp_del | CREATE RULE rtest_emp_del AS ON DELETE TO rtest_emp DO INSERT INTO rtest_emplog (ename, who, "action", newsal, oldsal) VALUES (old.ename, "current_user"(), 'fired '::bpchar, '$0.00'::money, old.salary);
rtest_emp | rtest_emp_ins | CREATE RULE rtest_emp_ins AS ON INSERT TO rtest_emp DO INSERT INTO rtest_emplog (ename, who, "action", newsal, oldsal) VALUES (new.ename, "current_user"(), 'hired '::bpchar, new.salary, '$0.00'::money);
rtest_emp | rtest_emp_upd | CREATE RULE rtest_emp_upd AS ON UPDATE TO rtest_emp WHERE (new.salary <> old.salary) DO INSERT INTO rtest_emplog (ename, who, "action", newsal, oldsal) VALUES (new.ename, "current_user"(), 'honored '::bpchar, new.salary, old.salary);
rtest_nothn1 | rtest_nothn_r1 | CREATE RULE rtest_nothn_r1 AS ON INSERT TO rtest_nothn1 WHERE ((new.a >= 10) AND (new.a < 20)) DO INSTEAD SELECT 1;
rtest_nothn1 | rtest_nothn_r2 | CREATE RULE rtest_nothn_r2 AS ON INSERT TO rtest_nothn1 WHERE ((new.a >= 30) AND (new.a < 40)) DO INSTEAD NOTHING;
rtest_nothn2 | rtest_nothn_r3 | CREATE RULE rtest_nothn_r3 AS ON INSERT TO rtest_nothn2 WHERE (new.a >= 100) DO INSTEAD INSERT INTO rtest_nothn3 (a, b) VALUES (new.a, new.b);
rtest_nothn2 | rtest_nothn_r4 | CREATE RULE rtest_nothn_r4 AS ON INSERT TO rtest_nothn2 DO INSTEAD NOTHING;
rtest_order1 | rtest_order_r1 | CREATE RULE rtest_order_r1 AS ON INSERT TO rtest_order1 DO INSTEAD INSERT INTO rtest_order2 (a, b, c) VALUES (new.a, nextval('rtest_seq'::text), 'rule 1 - this should run 3rd or 4th'::text);
rtest_order1 | rtest_order_r2 | CREATE RULE rtest_order_r2 AS ON INSERT TO rtest_order1 DO INSERT INTO rtest_order2 (a, b, c) VALUES (new.a, nextval('rtest_seq'::text), 'rule 2 - this should run 1st'::text);
rtest_order1 | rtest_order_r3 | CREATE RULE rtest_order_r3 AS ON INSERT TO rtest_order1 DO INSTEAD INSERT INTO rtest_order2 (a, b, c) VALUES (new.a, nextval('rtest_seq'::text), 'rule 3 - this should run 3rd or 4th'::text);
rtest_order1 | rtest_order_r4 | CREATE RULE rtest_order_r4 AS ON INSERT TO rtest_order1 WHERE (new.a < 100) DO INSTEAD INSERT INTO rtest_order2 (a, b, c) VALUES (new.a, nextval('rtest_seq'::text), 'rule 4 - this should run 2nd'::text);
rtest_person | rtest_pers_del | CREATE RULE rtest_pers_del AS ON DELETE TO rtest_person DO DELETE FROM rtest_admin WHERE (rtest_admin.pname = old.pname);
rtest_person | rtest_pers_upd | CREATE RULE rtest_pers_upd AS ON UPDATE TO rtest_person DO UPDATE rtest_admin SET pname = new.pname WHERE (rtest_admin.pname = old.pname);
rtest_system | rtest_sys_del | CREATE RULE rtest_sys_del AS ON DELETE TO rtest_system DO (DELETE FROM rtest_interface WHERE (rtest_interface.sysname = old.sysname); DELETE FROM rtest_admin WHERE (rtest_admin.sysname = old.sysname); );
rtest_system | rtest_sys_upd | CREATE RULE rtest_sys_upd AS ON UPDATE TO rtest_system DO (UPDATE rtest_interface SET sysname = new.sysname WHERE (rtest_interface.sysname = old.sysname); UPDATE rtest_admin SET sysname = new.sysname WHERE (rtest_admin.sysname = old.sysname); );
rtest_t4 | rtest_t4_ins1 | CREATE RULE rtest_t4_ins1 AS ON INSERT TO rtest_t4 WHERE ((new.a >= 10) AND (new.a < 20)) DO INSTEAD INSERT INTO rtest_t5 (a, b) VALUES (new.a, new.b);
rtest_t4 | rtest_t4_ins2 | CREATE RULE rtest_t4_ins2 AS ON INSERT TO rtest_t4 WHERE ((new.a >= 20) AND (new.a < 30)) DO INSERT INTO rtest_t6 (a, b) VALUES (new.a, new.b);
rtest_t5 | rtest_t5_ins | CREATE RULE rtest_t5_ins AS ON INSERT TO rtest_t5 WHERE (new.a > 15) DO INSERT INTO rtest_t7 (a, b) VALUES (new.a, new.b);
rtest_t6 | rtest_t6_ins | CREATE RULE rtest_t6_ins AS ON INSERT TO rtest_t6 WHERE (new.a > 25) DO INSTEAD INSERT INTO rtest_t8 (a, b) VALUES (new.a, new.b);
rtest_v1 | rtest_v1_del | CREATE RULE rtest_v1_del AS ON DELETE TO rtest_v1 DO INSTEAD DELETE FROM rtest_t1 WHERE (rtest_t1.a = old.a);
rtest_v1 | rtest_v1_ins | CREATE RULE rtest_v1_ins AS ON INSERT TO rtest_v1 DO INSTEAD INSERT INTO rtest_t1 (a, b) VALUES (new.a, new.b);
rtest_v1 | rtest_v1_upd | CREATE RULE rtest_v1_upd AS ON UPDATE TO rtest_v1 DO INSTEAD UPDATE rtest_t1 SET a = new.a, b = new.b WHERE (rtest_t1.a = old.a);
shoelace | shoelace_del | CREATE RULE shoelace_del AS ON DELETE TO shoelace DO INSTEAD DELETE FROM shoelace_data WHERE (shoelace_data.sl_name = old.sl_name);
shoelace | shoelace_ins | CREATE RULE shoelace_ins AS ON INSERT TO shoelace DO INSTEAD INSERT INTO shoelace_data (sl_name, sl_avail, sl_color, sl_len, sl_unit) VALUES (new.sl_name, new.sl_avail, new.sl_color, new.sl_len, new.sl_unit);
shoelace | shoelace_upd | CREATE RULE shoelace_upd AS ON UPDATE TO shoelace DO INSTEAD UPDATE shoelace_data SET sl_name = new.sl_name, sl_avail = new.sl_avail, sl_color = new.sl_color, sl_len = new.sl_len, sl_unit = new.sl_unit WHERE (shoelace_data.sl_name = old.sl_name);
shoelace_data | log_shoelace | CREATE RULE log_shoelace AS ON UPDATE TO shoelace_data WHERE (new.sl_avail <> old.sl_avail) DO INSERT INTO shoelace_log (sl_name, sl_avail, log_who, log_when) VALUES (new.sl_name, new.sl_avail, 'Al Bundy'::name, "timestamp"('epoch'::text));
shoelace_ok | shoelace_ok_ins | CREATE RULE shoelace_ok_ins AS ON INSERT TO shoelace_ok DO INSTEAD UPDATE shoelace SET sl_avail = (shoelace.sl_avail + new.ok_quant) WHERE (shoelace.sl_name = new.ok_name);
(27 rows)
FATAL 1: The system is shutting down
pqReadData() -- backend closed the channel unexpectedly.
This probably means the backend terminated abnormally
before or while processing the request.
connection to server was lost
#!/bin/sh
# $Header: /cvsroot/pgsql/src/test/regress/Attic/regress.sh,v 1.53 2000/09/29 17:17:37 petere Exp $
# $Header: /cvsroot/pgsql/src/test/regress/Attic/regress.sh,v 1.54 2000/10/07 14:39:20 momjian Exp $
#
if [ $# -eq 0 ]; then
echo "Syntax: $0 <hostname> [extra-tests]"
......@@ -11,7 +11,7 @@ shift
extratests="$*"
case $hostname in
i*86-pc-cygwin* | i386-*-qnx*)
i*86-pc-cygwin* | i386-*-qnx* | beos)
HOSTLOC="-h localhost"
;;
*)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册