Fix for typo in gram.y

This commit is contained in:
Bruce Momjian 1999-01-18 06:32:27 +00:00
parent be321b7488
commit fd7b963316
4 changed files with 108 additions and 92 deletions

View File

@ -4,7 +4,7 @@
# Makefile for catalog # Makefile for catalog
# #
# IDENTIFICATION # IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/catalog/Makefile,v 1.15 1999/01/17 06:18:14 momjian Exp $ # $Header: /cvsroot/pgsql/src/backend/catalog/Makefile,v 1.16 1999/01/18 06:32:24 momjian Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -57,8 +57,7 @@ depend dep:
clean: clean:
rm -f SUBSYS.o $(OBJS) global1.bki.source local1_template1.bki.source \ rm -f SUBSYS.o $(OBJS) global1.bki.source local1_template1.bki.source \
global1.description local1_template1.description \ global1.description local1_template1.description
$(GENBKI)
ifeq (depend,$(wildcard depend)) ifeq (depend,$(wildcard depend))
include depend include depend

View File

@ -10,7 +10,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.43 1999/01/18 00:09:51 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.44 1999/01/18 06:32:25 momjian Exp $
* *
* HISTORY * HISTORY
* AUTHOR DATE MAJOR EVENT * AUTHOR DATE MAJOR EVENT
@ -2794,7 +2794,7 @@ SelectStmt: select_w_o_sort sort_clause for_update_clause
/* finally attach the sort clause */ /* finally attach the sort clause */
first_select->sortClause = $2; first_select->sortClause = $2;
first_select>forUpdate = $3; first_select->forUpdate = $3;
$$ = (Node *)first_select; $$ = (Node *)first_select;
} }
if ((SelectStmt *)$$)->forUpdate != NULL) if ((SelectStmt *)$$)->forUpdate != NULL)

View File

@ -21,7 +21,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.98 1999/01/17 06:19:05 momjian Exp $ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.99 1999/01/18 06:32:26 momjian Exp $
* *
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb * Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
* *
@ -56,7 +56,7 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include <sys/param.h> /* for MAXHOSTNAMELEN on most */ #include <sys/param.h> /* for MAXHOSTNAMELEN on most */
#ifdef solaris_sparc #ifdef solaris_sparc
#include <netdb.h> /* for MAXHOSTNAMELEN on some */ #include <netdb.h> /* for MAXHOSTNAMELEN on some */
#endif #endif
@ -100,25 +100,25 @@ static void AddAcl(char *aclbuf, const char *keyword);
static char *GetPrivileges(const char *s); static char *GetPrivileges(const char *s);
static void becomeUser(FILE *fout, const char *username); static void becomeUser(FILE *fout, const char *username);
extern char *optarg; extern char *optarg;
extern int optind, extern int optind,
opterr; opterr;
/* global decls */ /* global decls */
bool g_verbose; /* User wants verbose narration of our bool g_verbose; /* User wants verbose narration of our
* activities. */ * activities. */
int g_last_builtin_oid; /* value of the last builtin oid */ int g_last_builtin_oid; /* value of the last builtin oid */
FILE *g_fout; /* the script file */ FILE *g_fout; /* the script file */
PGconn *g_conn; /* the database connection */ PGconn *g_conn; /* the database connection */
bool force_quotes; /* User wants to suppress double-quotes */ bool force_quotes; /* User wants to suppress double-quotes */
int dumpData; /* dump data using proper insert strings */ int dumpData; /* dump data using proper insert strings */
int attrNames; /* put attr names into insert strings */ int attrNames; /* put attr names into insert strings */
int schemaOnly; int schemaOnly;
int dataOnly; int dataOnly;
int aclsOption; int aclsOption;
char g_opaque_type[10]; /* name for the opaque type */ char g_opaque_type[10]; /* name for the opaque type */
/* placeholders for the delimiters for comments */ /* placeholders for the delimiters for comments */
char g_comment_start[10]; char g_comment_start[10];
@ -183,8 +183,8 @@ exit_nicely(PGconn *conn)
static bool static bool
isViewRule(char *relname) isViewRule(char *relname)
{ {
PGresult *res; PGresult *res;
int ntups; int ntups;
char query[MAXQUERYLEN]; char query[MAXQUERYLEN];
res = PQexec(g_conn, "begin"); res = PQexec(g_conn, "begin");
@ -319,13 +319,13 @@ dumpClasses_dumpData(FILE *fout, const char *classname,
const TableInfo tblinfo, bool oids) const TableInfo tblinfo, bool oids)
{ {
PGresult *res; PGresult *res;
char query[255]; char query[255];
int actual_atts; /* number of attrs in this a table */ int actual_atts; /* number of attrs in this a table */
char expandbuf[COPYBUFSIZ]; char expandbuf[COPYBUFSIZ];
char q[MAXQUERYLEN]; char q[MAXQUERYLEN];
int tuple; int tuple;
int field; int field;
sprintf(query, "SELECT * FROM %s", fmtId(classname, force_quotes)); sprintf(query, "SELECT * FROM %s", fmtId(classname, force_quotes));
res = PQexec(g_conn, query); res = PQexec(g_conn, query);
@ -425,7 +425,7 @@ dumpClasses(const TableInfo *tblinfo, const int numTables, FILE *fout,
{ {
int i; int i;
char *all_only; char *all_only;
if (onlytable == NULL) if (onlytable == NULL)
all_only = "all"; all_only = "all";
@ -486,12 +486,11 @@ static void
prompt_for_password(char *username, char *password) prompt_for_password(char *username, char *password)
{ {
char buf[512]; char buf[512];
int length; int length;
#ifdef HAVE_TERMIOS_H #ifdef HAVE_TERMIOS_H
struct termios t_orig, struct termios t_orig,
t; t;
#endif #endif
printf("Username: "); printf("Username: ");
@ -539,21 +538,21 @@ prompt_for_password(char *username, char *password)
int int
main(int argc, char **argv) main(int argc, char **argv)
{ {
int c; int c;
const char *progname; const char *progname;
const char *filename = NULL; const char *filename = NULL;
const char *dbname = NULL; const char *dbname = NULL;
const char *pghost = NULL; const char *pghost = NULL;
const char *pgport = NULL; const char *pgport = NULL;
char *tablename = NULL; char *tablename = NULL;
int oids = 0; int oids = 0;
TableInfo *tblinfo; TableInfo *tblinfo;
int numTables; int numTables;
char connect_string[512] = ""; char connect_string[512] = "";
char tmp_string[128]; char tmp_string[128];
char username[100]; char username[100];
char password[100]; char password[100];
int use_password = 0; int use_password = 0;
g_verbose = false; g_verbose = false;
force_quotes = true; force_quotes = true;
@ -735,11 +734,11 @@ main(int argc, char **argv)
TypeInfo * TypeInfo *
getTypes(int *numTypes) getTypes(int *numTypes)
{ {
PGresult *res; PGresult *res;
int ntups; int ntups;
int i; int i;
char query[MAXQUERYLEN]; char query[MAXQUERYLEN];
TypeInfo *tinfo; TypeInfo *tinfo;
int i_oid; int i_oid;
int i_typowner; int i_typowner;
@ -864,12 +863,12 @@ getTypes(int *numTypes)
OprInfo * OprInfo *
getOperators(int *numOprs) getOperators(int *numOprs)
{ {
PGresult *res; PGresult *res;
int ntups; int ntups;
int i; int i;
char query[MAXQUERYLEN]; char query[MAXQUERYLEN];
OprInfo *oprinfo; OprInfo *oprinfo;
int i_oid; int i_oid;
int i_oprname; int i_oprname;
@ -1207,11 +1206,11 @@ clearAggInfo(AggInfo *agginfo, int numArgs)
AggInfo * AggInfo *
getAggregates(int *numAggs) getAggregates(int *numAggs)
{ {
PGresult *res; PGresult *res;
int ntups; int ntups;
int i; int i;
char query[MAXQUERYLEN]; char query[MAXQUERYLEN];
AggInfo *agginfo; AggInfo *agginfo;
int i_oid; int i_oid;
int i_aggname; int i_aggname;
@ -1301,11 +1300,11 @@ getAggregates(int *numAggs)
FuncInfo * FuncInfo *
getFuncs(int *numFuncs) getFuncs(int *numFuncs)
{ {
PGresult *res; PGresult *res;
int ntups; int ntups;
int i; int i;
char query[MAXQUERYLEN]; char query[MAXQUERYLEN];
FuncInfo *finfo; FuncInfo *finfo;
int i_oid; int i_oid;
int i_proname; int i_proname;
@ -1401,11 +1400,11 @@ getFuncs(int *numFuncs)
TableInfo * TableInfo *
getTables(int *numTables, FuncInfo *finfo, int numFuncs) getTables(int *numTables, FuncInfo *finfo, int numFuncs)
{ {
PGresult *res; PGresult *res;
int ntups; int ntups;
int i; int i;
char query[MAXQUERYLEN]; char query[MAXQUERYLEN];
TableInfo *tblinfo; TableInfo *tblinfo;
int i_oid; int i_oid;
int i_relname; int i_relname;
@ -1734,11 +1733,11 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
InhInfo * InhInfo *
getInherits(int *numInherits) getInherits(int *numInherits)
{ {
PGresult *res; PGresult *res;
int ntups; int ntups;
int i; int i;
char query[MAXQUERYLEN]; char query[MAXQUERYLEN];
InhInfo *inhinfo; InhInfo *inhinfo;
int i_inhrel; int i_inhrel;
int i_inhparent; int i_inhparent;
@ -1799,13 +1798,13 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
{ {
int i, int i,
j; j;
char q[MAXQUERYLEN]; char q[MAXQUERYLEN];
int i_attname; int i_attname;
int i_typname; int i_typname;
int i_atttypmod; int i_atttypmod;
int i_attnotnull; int i_attnotnull;
int i_atthasdef; int i_atthasdef;
PGresult *res; PGresult *res;
int ntups; int ntups;
for (i = 0; i < numTables; i++) for (i = 0; i < numTables; i++)
@ -1910,10 +1909,10 @@ IndInfo *
getIndices(int *numIndices) getIndices(int *numIndices)
{ {
int i; int i;
char query[MAXQUERYLEN]; char query[MAXQUERYLEN];
PGresult *res; PGresult *res;
int ntups; int ntups;
IndInfo *indinfo; IndInfo *indinfo;
int i_indexrelname; int i_indexrelname;
int i_indrelname; int i_indrelname;
@ -2002,7 +2001,7 @@ dumpTypes(FILE *fout, FuncInfo *finfo, int numFuncs,
TypeInfo *tinfo, int numTypes) TypeInfo *tinfo, int numTypes)
{ {
int i; int i;
char q[MAXQUERYLEN]; char q[MAXQUERYLEN];
int funcInd; int funcInd;
for (i = 0; i < numTypes; i++) for (i = 0; i < numTypes; i++)
@ -2175,7 +2174,7 @@ dumpOneFunc(FILE *fout, FuncInfo *finfo, int i,
TypeInfo *tinfo, int numTypes) TypeInfo *tinfo, int numTypes)
{ {
char q[MAXQUERYLEN]; char q[MAXQUERYLEN];
int j; int j;
char *func_def; char *func_def;
char func_lang[NAMEDATALEN + 1]; char func_lang[NAMEDATALEN + 1];
@ -2276,7 +2275,7 @@ void
dumpOprs(FILE *fout, OprInfo *oprinfo, int numOperators, dumpOprs(FILE *fout, OprInfo *oprinfo, int numOperators,
TypeInfo *tinfo, int numTypes) TypeInfo *tinfo, int numTypes)
{ {
int i; int i;
char q[MAXQUERYLEN]; char q[MAXQUERYLEN];
char leftarg[MAXQUERYLEN]; char leftarg[MAXQUERYLEN];
char rightarg[MAXQUERYLEN]; char rightarg[MAXQUERYLEN];
@ -2383,14 +2382,14 @@ void
dumpAggs(FILE *fout, AggInfo *agginfo, int numAggs, dumpAggs(FILE *fout, AggInfo *agginfo, int numAggs,
TypeInfo *tinfo, int numTypes) TypeInfo *tinfo, int numTypes)
{ {
int i; int i;
char q[MAXQUERYLEN]; char q[MAXQUERYLEN];
char sfunc1[MAXQUERYLEN]; char sfunc1[MAXQUERYLEN];
char sfunc2[MAXQUERYLEN]; char sfunc2[MAXQUERYLEN];
char basetype[MAXQUERYLEN]; char basetype[MAXQUERYLEN];
char finalfunc[MAXQUERYLEN]; char finalfunc[MAXQUERYLEN];
char comma1[2], char comma1[2],
comma2[2]; comma2[2];
for (i = 0; i < numAggs; i++) for (i = 0; i < numAggs; i++)
{ {
@ -2522,9 +2521,9 @@ dumpACL(FILE *fout, TableInfo tbinfo)
{ {
const char *acls = tbinfo.relacl; const char *acls = tbinfo.relacl;
char *aclbuf, char *aclbuf,
*tok, *tok,
*eqpos, *eqpos,
*priv; *priv;
if (strlen(acls) == 0) if (strlen(acls) == 0)
return; /* table has default permissions */ return; /* table has default permissions */
@ -2601,17 +2600,26 @@ dumpTables(FILE *fout, TableInfo *tblinfo, int numTables,
int i, int i,
j, j,
k; k;
char q[MAXQUERYLEN]; char q[MAXQUERYLEN];
char **parentRels; /* list of names of parent relations */ char *serialSeq = NULL; /* implicit sequence name created by SERIAL datatype */
const char *serialSeqSuffix = "_id_seq"; /* suffix for implicit SERIAL sequences */
char **parentRels; /* list of names of parent relations */
int numParents; int numParents;
int actual_atts; /* number of attrs in this CREATE statment */ int actual_atts; /* number of attrs in this CREATE statment */
/* First - dump SEQUENCEs */ /* First - dump SEQUENCEs */
if (tablename)
{
serialSeq = malloc (strlen (tablename) + strlen (serialSeqSuffix) + 1);
strcpy (serialSeq, tablename);
strcat (serialSeq, serialSeqSuffix);
}
for (i = 0; i < numTables; i++) for (i = 0; i < numTables; i++)
{ {
if (!(tblinfo[i].sequence)) if (!(tblinfo[i].sequence))
continue; continue;
if (!tablename || (!strcmp(tblinfo[i].relname, tablename))) if (!tablename || (!strcmp(tblinfo[i].relname, tablename))
|| (serialSeq && !strcmp(tblinfo[i].relname,serialSeq)))
{ {
becomeUser(fout, tblinfo[i].usename); becomeUser(fout, tblinfo[i].usename);
dumpSequence(fout, tblinfo[i]); dumpSequence(fout, tblinfo[i]);
@ -2619,6 +2627,8 @@ dumpTables(FILE *fout, TableInfo *tblinfo, int numTables,
dumpACL(fout, tblinfo[i]); dumpACL(fout, tblinfo[i]);
} }
} }
if (tablename)
free (serialSeq);
for (i = 0; i < numTables; i++) for (i = 0; i < numTables; i++)
{ {
@ -2734,15 +2744,15 @@ dumpIndices(FILE *fout, IndInfo *indinfo, int numIndices,
int i, int i,
k; k;
int tableInd; int tableInd;
char attlist[1000]; char attlist[1000];
char *classname[INDEX_MAX_KEYS]; char *classname[INDEX_MAX_KEYS];
char *funcname; /* the name of the function to comput the char *funcname; /* the name of the function to comput the
* index key from */ * index key from */
int indkey, int indkey,
indclass; indclass;
int nclass; int nclass;
char q[MAXQUERYLEN], char q[MAXQUERYLEN],
id1[MAXQUERYLEN], id1[MAXQUERYLEN],
id2[MAXQUERYLEN]; id2[MAXQUERYLEN];
PGresult *res; PGresult *res;
@ -2895,7 +2905,7 @@ dumpTuples(PGresult *res, FILE *fout, int *attrmap)
k; k;
int m, int m,
n; n;
char **outVals = NULL; /* values to copy out */ char **outVals = NULL; /* values to copy out */
n = PQntuples(res); n = PQntuples(res);
m = PQnfields(res); m = PQnfields(res);
@ -2948,7 +2958,7 @@ dumpTuples(PGresult *res, FILE *fout, int *attrmap)
static void static void
setMaxOid(FILE *fout) setMaxOid(FILE *fout)
{ {
PGresult *res; PGresult *res;
Oid max_oid; Oid max_oid;
res = PQexec(g_conn, "CREATE TABLE pgdump_oid (dummy int4)"); res = PQexec(g_conn, "CREATE TABLE pgdump_oid (dummy int4)");
@ -3001,7 +3011,7 @@ setMaxOid(FILE *fout)
static int static int
findLastBuiltinOid(void) findLastBuiltinOid(void)
{ {
PGresult *res; PGresult *res;
int ntups; int ntups;
int last_oid; int last_oid;
@ -3033,9 +3043,9 @@ findLastBuiltinOid(void)
static char * static char *
checkForQuote(const char *s) checkForQuote(const char *s)
{ {
char *r; char *r;
char c; char c;
char *result; char *result;
int j = 0; int j = 0;
@ -3064,16 +3074,16 @@ checkForQuote(const char *s)
static void static void
dumpSequence(FILE *fout, TableInfo tbinfo) dumpSequence(FILE *fout, TableInfo tbinfo)
{ {
PGresult *res; PGresult *res;
int4 last, int4 last,
incby, incby,
maxv, maxv,
minv, minv,
cache; cache;
char cycled, char cycled,
called, called,
*t; *t;
char query[MAXQUERYLEN]; char query[MAXQUERYLEN];
sprintf(query, sprintf(query,
"SELECT sequence_name, last_value, increment_by, max_value, " "SELECT sequence_name, last_value, increment_by, max_value, "

View File

@ -28,6 +28,13 @@ ZeroSecs
@ 0 @ 0
(1 row) (1 row)
QUERY: SET DateStyle = 'Postgres,noneuropean';
QUERY: SELECT datetime('1994-01-01', '11:00') AS "Jan_01_1994_11am";
Jan_01_1994_11am
----------------------------
Sat Jan 01 11:00:00 1994 PST
(1 row)
QUERY: CREATE TABLE DATETIME_TBL( d1 datetime); QUERY: CREATE TABLE DATETIME_TBL( d1 datetime);
QUERY: INSERT INTO DATETIME_TBL VALUES ('current'); QUERY: INSERT INTO DATETIME_TBL VALUES ('current');
QUERY: INSERT INTO DATETIME_TBL VALUES ('today'); QUERY: INSERT INTO DATETIME_TBL VALUES ('today');