mirror of
https://github.com/postgres/postgres.git
synced 2025-04-21 12:05:57 +03:00
Finished merging in src/backend from Dr. George's source tree
This commit is contained in:
parent
e11744e164
commit
7344d69898
@ -7,7 +7,7 @@
|
|||||||
* Copyright (c) 1994, Regents of the University of California
|
* Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.3 1996/07/16 07:12:27 scrappy Exp $
|
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.4 1996/07/23 02:23:05 scrappy Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -137,7 +137,7 @@ AttributeTupleForm attrtypes[MAXATTR]; /* points to attribute info */
|
|||||||
static char *values[MAXATTR]; /* cooresponding attribute values */
|
static char *values[MAXATTR]; /* cooresponding attribute values */
|
||||||
int numattr; /* number of attributes for cur. rel */
|
int numattr; /* number of attributes for cur. rel */
|
||||||
#ifdef OPENLINK_PATCHES
|
#ifdef OPENLINK_PATCHES
|
||||||
extern int fsyncOff; /* do not fsync the database */
|
extern int fsyncOff; /* do not fsync the database */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(WIN32) || defined(PORTNAME_next)
|
#if defined(WIN32) || defined(PORTNAME_next)
|
||||||
@ -187,7 +187,9 @@ typedef void (*sig_func)();
|
|||||||
* error handling / abort routines
|
* error handling / abort routines
|
||||||
* ----------------
|
* ----------------
|
||||||
*/
|
*/
|
||||||
#if !defined(PORTNAME_bsdi) && !defined(PORTNAME_bsdi_2_1)
|
# if !defined(PORTNAME_BSD44_derived) && \
|
||||||
|
!defined(PORTNAME_bsdi) && \
|
||||||
|
!defined(PORTNAME_bsdi_2_1)
|
||||||
void err()
|
void err()
|
||||||
{
|
{
|
||||||
Warnings++;
|
Warnings++;
|
||||||
@ -279,6 +281,11 @@ BootstrapMain(int argc, char *argv[])
|
|||||||
case 'C':
|
case 'C':
|
||||||
Noversion = 1;
|
Noversion = 1;
|
||||||
break;
|
break;
|
||||||
|
#ifdef OPENLINK_PATCHES
|
||||||
|
case 'F':
|
||||||
|
fsyncOff = 1;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
case 'O':
|
case 'O':
|
||||||
override = true;
|
override = true;
|
||||||
break;
|
break;
|
||||||
@ -288,12 +295,6 @@ BootstrapMain(int argc, char *argv[])
|
|||||||
case 'P':/* specify port */
|
case 'P':/* specify port */
|
||||||
portFd = atoi(optarg);
|
portFd = atoi(optarg);
|
||||||
break;
|
break;
|
||||||
#ifdef OPENLINK_PATCHES
|
|
||||||
case 'F':
|
|
||||||
fsyncOff = 1;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
usage();
|
usage();
|
||||||
break;
|
break;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.1.1.1 1996/07/09 06:21:19 scrappy Exp $
|
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.2 1996/07/23 02:23:15 scrappy Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -650,6 +650,10 @@ GetIndexRelations(Oid main_relation_oid,
|
|||||||
heap_endscan(scandesc);
|
heap_endscan(scandesc);
|
||||||
heap_close(pg_index_rel);
|
heap_close(pg_index_rel);
|
||||||
|
|
||||||
|
/* We cannot trust to relhasindex of the main_relation now, so... */
|
||||||
|
if ( *n_indices == 0 )
|
||||||
|
return;
|
||||||
|
|
||||||
*index_rels = (Relation *) palloc(*n_indices * sizeof(Relation));
|
*index_rels = (Relation *) palloc(*n_indices * sizeof(Relation));
|
||||||
|
|
||||||
for (i = 0, scan = head; i < *n_indices; i++, scan = scan->next) {
|
for (i = 0, scan = head; i < *n_indices; i++, scan = scan->next) {
|
||||||
@ -726,6 +730,67 @@ CopyReadAttribute(int attno, FILE *fp, bool *isnull, char *delim)
|
|||||||
}
|
}
|
||||||
}else if (c == '\\') {
|
}else if (c == '\\') {
|
||||||
c = getc(fp);
|
c = getc(fp);
|
||||||
|
#ifdef ESCAPE_PATCH
|
||||||
|
#define ISOCTAL(c) (((c) >= '0') && ((c) <= '7'))
|
||||||
|
#define VALUE(c) ((c) - '0')
|
||||||
|
if (feof(fp)) {
|
||||||
|
*isnull = (bool) false;
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
switch (c) {
|
||||||
|
case '0':
|
||||||
|
case '1':
|
||||||
|
case '2':
|
||||||
|
case '3':
|
||||||
|
case '4':
|
||||||
|
case '5':
|
||||||
|
case '6':
|
||||||
|
case '7': {
|
||||||
|
int val;
|
||||||
|
val = VALUE(c);
|
||||||
|
c = getc(fp);
|
||||||
|
if (ISOCTAL(c)) {
|
||||||
|
val = (val<<3) + VALUE(c);
|
||||||
|
c = getc(fp);
|
||||||
|
if (ISOCTAL(c)) {
|
||||||
|
val = (val<<3) + VALUE(c);
|
||||||
|
} else {
|
||||||
|
if (feof(fp)) {
|
||||||
|
*isnull = (bool) false;
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
ungetc(c, fp);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (feof(fp)) {
|
||||||
|
*isnull = (bool) false;
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
ungetc(c, fp);
|
||||||
|
}
|
||||||
|
c = val & 0377;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'b':
|
||||||
|
c = '\b';
|
||||||
|
break;
|
||||||
|
case 'f':
|
||||||
|
c = '\f';
|
||||||
|
break;
|
||||||
|
case 'n':
|
||||||
|
c = '\n';
|
||||||
|
break;
|
||||||
|
case 'r':
|
||||||
|
c = '\r';
|
||||||
|
break;
|
||||||
|
case 't':
|
||||||
|
c = '\t';
|
||||||
|
break;
|
||||||
|
case 'v':
|
||||||
|
c = '\v';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}else if (inString(c,delim) || c == '\n') {
|
}else if (inString(c,delim) || c == '\n') {
|
||||||
done = 1;
|
done = 1;
|
||||||
}
|
}
|
||||||
@ -743,6 +808,39 @@ CopyReadAttribute(int attno, FILE *fp, bool *isnull, char *delim)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ESCAPE_PATCH
|
||||||
|
static void
|
||||||
|
CopyAttributeOut(FILE *fp, char *string, char *delim)
|
||||||
|
{
|
||||||
|
char c;
|
||||||
|
int is_array = false;
|
||||||
|
int len = strlen(string);
|
||||||
|
|
||||||
|
/* XXX - This is a kludge, we should check the data type */
|
||||||
|
if (len && (string[0] == '{') && (string[len-1] == '}')) {
|
||||||
|
is_array = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( ; c = *string; string++) {
|
||||||
|
if ((c == delim[0]) || (c == '\n')) {
|
||||||
|
fputc('\\', fp);
|
||||||
|
} else if ((c == '\\') && is_array) {
|
||||||
|
if (*(string+1) == '\\') {
|
||||||
|
/* translate \\ to \\\\ */
|
||||||
|
fputc('\\', fp);
|
||||||
|
fputc('\\', fp);
|
||||||
|
fputc('\\', fp);
|
||||||
|
string++;
|
||||||
|
} else if (*(string+1) == '"') {
|
||||||
|
/* translate \" to \\\" */
|
||||||
|
fputc('\\', fp);
|
||||||
|
fputc('\\', fp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fputc(*string, fp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
static void
|
static void
|
||||||
CopyAttributeOut(FILE *fp, char *string, char *delim)
|
CopyAttributeOut(FILE *fp, char *string, char *delim)
|
||||||
{
|
{
|
||||||
@ -756,6 +854,7 @@ CopyAttributeOut(FILE *fp, char *string, char *delim)
|
|||||||
fputc(string[i], fp);
|
fputc(string[i], fp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns the number of tuples in a relation. Unfortunately, currently
|
* Returns the number of tuples in a relation. Unfortunately, currently
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.1.1.1 1996/07/09 06:21:31 scrappy Exp $
|
* $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.2 1996/07/23 02:23:25 scrappy Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -551,6 +551,7 @@ StreamServerPort(char *hostName, short portName, int *fdP)
|
|||||||
{
|
{
|
||||||
struct sockaddr_in sin;
|
struct sockaddr_in sin;
|
||||||
int fd;
|
int fd;
|
||||||
|
int one = 1;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
/* This is necessary to make it possible for a backend to use
|
/* This is necessary to make it possible for a backend to use
|
||||||
@ -576,6 +577,16 @@ StreamServerPort(char *hostName, short portName, int *fdP)
|
|||||||
return(STATUS_ERROR);
|
return(STATUS_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if((setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)&one,
|
||||||
|
sizeof(one))) == -1) {
|
||||||
|
(void) sprintf(PQerrormsg,
|
||||||
|
"FATAL: StreamServerPort: setsockopt (SO_REUSEADDR) failed: errno=%d\n",
|
||||||
|
errno);
|
||||||
|
fputs(PQerrormsg, stderr);
|
||||||
|
pqdebug("%s", PQerrormsg);
|
||||||
|
return(STATUS_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
sin.sin_family = AF_INET;
|
sin.sin_family = AF_INET;
|
||||||
sin.sin_port = htons(portName);
|
sin.sin_port = htons(portName);
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
# IDENTIFICATION
|
# IDENTIFICATION
|
||||||
# $Header: /cvsroot/pgsql/src/backend/parser/Attic/Makefile.inc,v 1.1.1.1 1996/07/09 06:21:39 scrappy Exp $
|
# $Header: /cvsroot/pgsql/src/backend/parser/Attic/Makefile.inc,v 1.2 1996/07/23 02:23:32 scrappy Exp $
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -34,13 +34,13 @@ $(objdir)/scan.o: scan.c
|
|||||||
|
|
||||||
|
|
||||||
SRCS_PARSER+= analyze.c catalog_utils.c dbcommands.c gram.c \
|
SRCS_PARSER+= analyze.c catalog_utils.c dbcommands.c gram.c \
|
||||||
keywords.c parser.c parse_query.c scan.c scansup.c
|
keywords.c parser.c parse_query.c scan.c scansup.c sysfunc.c
|
||||||
|
|
||||||
CLEANFILES+= scan.c ${PARSEYACCS}
|
CLEANFILES+= scan.c ${PARSEYACCS}
|
||||||
|
|
||||||
POSTGRES_DEPEND+= scan.c $(PARSEYACCS)
|
POSTGRES_DEPEND+= scan.c $(PARSEYACCS)
|
||||||
|
|
||||||
HEADERS+= catalog_utils.h io.h parse_query.h parsetree.h \
|
HEADERS+= catalog_utils.h io.h parse_query.h parsetree.h \
|
||||||
dbcommands.h keywords.h
|
dbcommands.h keywords.h sysfunc.c
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.1.1.1 1996/07/09 06:21:40 scrappy Exp $
|
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.2 1996/07/23 02:23:33 scrappy Exp $
|
||||||
*
|
*
|
||||||
* HISTORY
|
* HISTORY
|
||||||
* AUTHOR DATE MAJOR EVENT
|
* AUTHOR DATE MAJOR EVENT
|
||||||
@ -515,7 +515,7 @@ fetch_how_many: Iconst
|
|||||||
{ $$ = $1;
|
{ $$ = $1;
|
||||||
if ($1 <= 0) elog(WARN,"Please specify nonnegative count for fetch"); }
|
if ($1 <= 0) elog(WARN,"Please specify nonnegative count for fetch"); }
|
||||||
| ALL { $$ = 0; /* 0 means fetch all tuples*/}
|
| ALL { $$ = 0; /* 0 means fetch all tuples*/}
|
||||||
| /*EMPTY*/ { $$ = 0; /*default*/ }
|
| /*EMPTY*/ { $$ = 1; /*default*/ }
|
||||||
;
|
;
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.1.1.1 1996/07/09 06:21:41 scrappy Exp $
|
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.2 1996/07/23 02:23:34 scrappy Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -29,6 +29,7 @@
|
|||||||
#include "nodes/parsenodes.h"
|
#include "nodes/parsenodes.h"
|
||||||
#include "parser/keywords.h"
|
#include "parser/keywords.h"
|
||||||
#include "parser/scansup.h"
|
#include "parser/scansup.h"
|
||||||
|
#include "parser/sysfunc.h"
|
||||||
#include "parse.h"
|
#include "parse.h"
|
||||||
#include "utils/elog.h"
|
#include "utils/elog.h"
|
||||||
#include "utils/palloc.h"
|
#include "utils/palloc.h"
|
||||||
@ -61,6 +62,8 @@ digit [0-9]
|
|||||||
letter [_A-Za-z]
|
letter [_A-Za-z]
|
||||||
letter_or_digit [_A-Za-z0-9]
|
letter_or_digit [_A-Za-z0-9]
|
||||||
|
|
||||||
|
sysfunc SYS_{letter}{letter_or_digit}*
|
||||||
|
|
||||||
identifier {letter}{letter_or_digit}*
|
identifier {letter}{letter_or_digit}*
|
||||||
|
|
||||||
self [,()\[\].;$\:\+\-\*\/\<\>\=\|]
|
self [,()\[\].;$\:\+\-\*\/\<\>\=\|]
|
||||||
@ -83,6 +86,11 @@ space [ \t\n\f]
|
|||||||
other .
|
other .
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
{sysfunc} {
|
||||||
|
yylval.str = pstrdup(SystemFunctionHandler((char *)yytext));
|
||||||
|
return (SCONST);
|
||||||
|
}
|
||||||
|
|
||||||
{comment} { /* ignore */ }
|
{comment} { /* ignore */ }
|
||||||
|
|
||||||
"::" { return TYPECAST; }
|
"::" { return TYPECAST; }
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/parser/scansup.c,v 1.1.1.1 1996/07/09 06:21:41 scrappy Exp $
|
* $Header: /cvsroot/pgsql/src/backend/parser/scansup.c,v 1.2 1996/07/23 02:23:35 scrappy Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -134,7 +134,11 @@ scanstr(char *s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
elog (WARN, "Bad escape sequence, s[i] = %d", s[i]);
|
#ifdef ESCAPE_PATCH
|
||||||
|
newStr[j] = s[i];
|
||||||
|
#else
|
||||||
|
elog (WARN, "Bad escape sequence, s[i] = %d", s[i]);
|
||||||
|
#endif
|
||||||
} /* switch */
|
} /* switch */
|
||||||
} /* s[i] == '\\' */
|
} /* s[i] == '\\' */
|
||||||
else
|
else
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.2 1996/07/16 07:13:07 scrappy Exp $
|
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.3 1996/07/23 02:23:47 scrappy Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
*
|
*
|
||||||
@ -49,7 +49,9 @@
|
|||||||
#define MAXINT INT_MAX
|
#define MAXINT INT_MAX
|
||||||
#else
|
#else
|
||||||
#include <netdb.h> /* for MAXHOSTNAMELEN on some */
|
#include <netdb.h> /* for MAXHOSTNAMELEN on some */
|
||||||
# if defined(PORTNAME_BSD44_derived) || defined(PORTNAME_bsdi) || defined(PORTNAME_bsdi_2_1)
|
# if defined(PORTNAME_BSD44_derived) || \
|
||||||
|
defined(PORTNAME_bsdi) || \
|
||||||
|
defined(PORTNAME_bsdi_2_1)
|
||||||
# include <machine/limits.h>
|
# include <machine/limits.h>
|
||||||
# define MAXINT INT_MAX
|
# define MAXINT INT_MAX
|
||||||
# else
|
# else
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteManip.c,v 1.1.1.1 1996/07/09 06:21:52 scrappy Exp $
|
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteManip.c,v 1.2 1996/07/23 02:23:54 scrappy Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -319,7 +319,7 @@ nodeHandleRIRAttributeRule(Node **nodePtr,
|
|||||||
if (name_to_look_for.data[0]) {
|
if (name_to_look_for.data[0]) {
|
||||||
Node *n;
|
Node *n;
|
||||||
|
|
||||||
n = FindMatchingTLEntry(targetlist, &name_to_look_for);
|
n = FindMatchingTLEntry(targetlist, (char *)&name_to_look_for);
|
||||||
if (n == NULL) {
|
if (n == NULL) {
|
||||||
*nodePtr = make_null(((Var*) node)->vartype);
|
*nodePtr = make_null(((Var*) node)->vartype);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user