Re: [HACKERS] Open 6.4 items - Mailing list pgsql-hackers
| From | Thomas G. Lockhart |
|---|---|
| Subject | Re: [HACKERS] Open 6.4 items |
| Date | |
| Msg-id | 35E2D619.7DD44B24@alumni.caltech.edu Whole thread Raw |
| In response to | Re: [HACKERS] Open 6.4 items (Tatsuo Ishii <t-ishii@sra.co.jp>) |
| List | pgsql-hackers |
> You could send me the patch. I also have another problem with 6.3.2
> pg_dump regarding 8bit or Upper case letters handling and some fixes
> for that. I would like to merge the fixes into 6.4.
OK, here is the patch. However, I've also already committed the patch to
the CVS source tree; hope that doesn't make it more difficult for you.
Thanks.
- Tom
*** ../src/bin/pg_dump/pg_dump.c.orig Thu Aug 6 05:12:51 1998
--- ../src/bin/pg_dump/pg_dump.c Tue Aug 18 05:57:44 1998
***************
*** 221,235 ****
if (oids)
{
! fprintf(fout, "COPY \"%s\" WITH OIDS FROM stdin;\n",
fmtId(classname));
! sprintf(query, "COPY \"%s\" WITH OIDS TO stdout;\n",
fmtId(classname));
}
else
{
! fprintf(fout, "COPY \"%s\" FROM stdin;\n", fmtId(classname));
! sprintf(query, "COPY \"%s\" TO stdout;\n", fmtId(classname));
}
res = PQexec(g_conn, query);
if (!res ||
--- 221,235 ----
if (oids)
{
! fprintf(fout, "COPY %s WITH OIDS FROM stdin;\n",
fmtId(classname));
! sprintf(query, "COPY %s WITH OIDS TO stdout;\n",
fmtId(classname));
}
else
{
! fprintf(fout, "COPY %s FROM stdin;\n", fmtId(classname));
! sprintf(query, "COPY %s TO stdout;\n", fmtId(classname));
}
res = PQexec(g_conn, query);
if (!res ||
***************
*** 316,322 ****
int tuple;
int field;
! sprintf(query, "SELECT * FROM \"%s\"", classname);
res = PQexec(g_conn, query);
if (!res ||
PQresultStatus(res) != PGRES_TUPLES_OK)
--- 316,322 ----
int tuple;
int field;
! sprintf(query, "SELECT * FROM %s", fmtId(classname));
res = PQexec(g_conn, query);
if (!res ||
PQresultStatus(res) != PGRES_TUPLES_OK)
***************
*** 327,333 ****
tuple = 0;
while (tuple < PQntuples(res))
{
! fprintf(fout, "INSERT INTO \"%s\" ", fmtId(classname));
if (attrNames)
{
int j;
--- 327,333 ----
tuple = 0;
while (tuple < PQntuples(res))
{
! fprintf(fout, "INSERT INTO %s ", fmtId(classname));
if (attrNames)
{
int j;
***************
*** 338,344 ****
{
if (tblinfo.inhAttrs[j] == 0)
{
! sprintf(q, "%s%s\"%s\"",
q,
(actual_atts > 0) ? "," : "",
fmtId(tblinfo.attnames[j]));
--- 338,344 ----
{
if (tblinfo.inhAttrs[j] == 0)
{
! sprintf(q, "%s%s%s",
q,
(actual_atts > 0) ? "," : "",
fmtId(tblinfo.attnames[j]));
***************
*** 1570,1576 ****
exit_nicely(g_conn);
}
tgfunc = finfo[findx].proname;
! sprintf(query, "CREATE TRIGGER \"%s\" ", PQgetvalue(res2, i2, i_tgname));
/* Trigger type */
findx = 0;
if (TRIGGER_FOR_BEFORE(tgtype))
--- 1570,1576 ----
exit_nicely(g_conn);
}
tgfunc = finfo[findx].proname;
! sprintf(query, "CREATE TRIGGER %s ", fmtId(PQgetvalue(res2, i2, i_tgname)));
/* Trigger type */
findx = 0;
if (TRIGGER_FOR_BEFORE(tgtype))
***************
*** 1597,1604 ****
else
strcat(query, " UPDATE");
}
! sprintf(query, "%s ON \"%s\" FOR EACH ROW EXECUTE PROCEDURE %s (",
! query, tblinfo[i].relname, tgfunc);
for (findx = 0; findx < tgnargs; findx++)
{
char *s,
--- 1597,1604 ----
else
strcat(query, " UPDATE");
}
! sprintf(query, "%s ON %s FOR EACH ROW EXECUTE PROCEDURE %s (",
! query, fmtId(tblinfo[i].relname), tgfunc);
for (findx = 0; findx < tgnargs; findx++)
{
char *s,
***************
*** 1967,1976 ****
becomeUser(fout, tinfo[i].usename);
sprintf(q,
! "CREATE TYPE \"%s\" "
"( internallength = %s, externallength = %s, input = %s, "
"output = %s, send = %s, receive = %s, default = '%s'",
! tinfo[i].typname,
tinfo[i].typlen,
tinfo[i].typprtlen,
tinfo[i].typinput,
--- 1967,1976 ----
becomeUser(fout, tinfo[i].usename);
sprintf(q,
! "CREATE TYPE %s "
"( internallength = %s, externallength = %s, input = %s, "
"output = %s, send = %s, receive = %s, default = '%s'",
! fmtId(tinfo[i].typname),
tinfo[i].typlen,
tinfo[i].typprtlen,
tinfo[i].typinput,
***************
*** 2033,2045 ****
becomeUser(fout, finfo[i].usename);
! sprintf(q, "CREATE FUNCTION \"%s\" (", finfo[i].proname);
for (j = 0; j < finfo[i].nargs; j++)
{
char *typname;
typname = findTypeByOid(tinfo, numTypes, finfo[i].argtypes[j]);
! sprintf(q, "%s%s\"%s\"",
q,
(j > 0) ? "," : "",
fmtId(typname));
--- 2033,2045 ----
becomeUser(fout, finfo[i].usename);
! sprintf(q, "CREATE FUNCTION %s (", fmtId(finfo[i].proname));
for (j = 0; j < finfo[i].nargs; j++)
{
char *typname;
typname = findTypeByOid(tinfo, numTypes, finfo[i].argtypes[j]);
! sprintf(q, "%s%s%s",
q,
(j > 0) ? "," : "",
fmtId(typname));
***************
*** 2400,2407 ****
/* Revoke Default permissions for PUBLIC */
fprintf(fout,
! "REVOKE ALL on \"%s\" from PUBLIC;\n",
! tbinfo.relname);
for (k = 0; k < l; k++)
{
--- 2400,2407 ----
/* Revoke Default permissions for PUBLIC */
fprintf(fout,
! "REVOKE ALL on %s from PUBLIC;\n",
! fmtId(tbinfo.relname));
for (k = 0; k < l; k++)
{
***************
*** 2409,2421 ****
{
if (ACLlist[k].user == (char *) NULL)
fprintf(fout,
! "GRANT %s on \"%s\" to PUBLIC;\n",
! ACLlist[k].privledges, tbinfo.relname);
else
fprintf(fout,
! "GRANT %s on \"%s\" to \"%s\";\n",
! ACLlist[k].privledges, tbinfo.relname,
! ACLlist[k].user);
}
}
}
--- 2409,2421 ----
{
if (ACLlist[k].user == (char *) NULL)
fprintf(fout,
! "GRANT %s on %s to PUBLIC;\n",
! ACLlist[k].privledges, fmtId(tbinfo.relname));
else
fprintf(fout,
! "GRANT %s on %s to %s;\n",
! ACLlist[k].privledges, fmtId(tbinfo.relname),
! fmtId(ACLlist[k].user));
}
}
}
***************
*** 2471,2477 ****
becomeUser(fout, tblinfo[i].usename);
! sprintf(q, "CREATE TABLE \"%s\" (", fmtId(tblinfo[i].relname));
actual_atts = 0;
for (j = 0; j < tblinfo[i].numatts; j++)
{
--- 2471,2477 ----
becomeUser(fout, tblinfo[i].usename);
! sprintf(q, "CREATE TABLE %s (", fmtId(tblinfo[i].relname));
actual_atts = 0;
for (j = 0; j < tblinfo[i].numatts; j++)
{
***************
*** 2481,2487 ****
/* Show lengths on bpchar and varchar */
if (!strcmp(tblinfo[i].typnames[j], "bpchar"))
{
! sprintf(q, "%s%s\"%s\" char",
q,
(actual_atts > 0) ? ", " : "",
fmtId(tblinfo[i].attnames[j]));
--- 2481,2487 ----
/* Show lengths on bpchar and varchar */
if (!strcmp(tblinfo[i].typnames[j], "bpchar"))
{
! sprintf(q, "%s%s%s char",
q,
(actual_atts > 0) ? ", " : "",
fmtId(tblinfo[i].attnames[j]));
***************
*** 2493,2499 ****
}
else if (!strcmp(tblinfo[i].typnames[j], "varchar"))
{
! sprintf(q, "%s%s\"%s\" %s",
q,
(actual_atts > 0) ? ", " : "",
fmtId(tblinfo[i].attnames[j]),
--- 2493,2499 ----
}
else if (!strcmp(tblinfo[i].typnames[j], "varchar"))
{
! sprintf(q, "%s%s%s %s",
q,
(actual_atts > 0) ? ", " : "",
fmtId(tblinfo[i].attnames[j]),
***************
*** 2506,2512 ****
}
else
{
! sprintf(q, "%s%s\"%s\" %s",
q,
(actual_atts > 0) ? ", " : "",
fmtId(tblinfo[i].attnames[j]),
--- 2506,2512 ----
}
else
{
! sprintf(q, "%s%s%s %s",
q,
(actual_atts > 0) ? ", " : "",
fmtId(tblinfo[i].attnames[j]),
***************
*** 2539,2545 ****
sprintf(q, "%s%s%s",
q,
(k > 0) ? ", " : "",
! parentRels[k]);
}
strcat(q, ")");
}
--- 2539,2545 ----
sprintf(q, "%s%s%s",
q,
(k > 0) ? ", " : "",
! fmtId(parentRels[k]));
}
strcat(q, ")");
}
***************
*** 2648,2654 ****
else
attname = tblinfo[tableInd].attnames[indkey];
if (funcname)
! sprintf(attlist + strlen(attlist), "%s\"%s\"",
(k == 0) ? "" : ", ", fmtId(attname));
else
{
--- 2648,2654 ----
else
attname = tblinfo[tableInd].attnames[indkey];
if (funcname)
! sprintf(attlist + strlen(attlist), "%s%s",
(k == 0) ? "" : ", ", fmtId(attname));
else
{
***************
*** 2659,2665 ****
attname, indinfo[i].indexrelname);
exit_nicely(g_conn);
}
! sprintf(attlist + strlen(attlist), "%s\"%s\" \"%s\"",
(k == 0) ? "" : ", ", fmtId(attname), fmtId(classname[k]));
free(classname[k]);
}
--- 2659,2665 ----
attname, indinfo[i].indexrelname);
exit_nicely(g_conn);
}
! sprintf(attlist + strlen(attlist), "%s%s %s",
(k == 0) ? "" : ", ", fmtId(attname), fmtId(classname[k]));
free(classname[k]);
}
***************
*** 2668,2681 ****
if (!tablename || (!strcmp(indinfo[i].indrelname, tablename)))
{
! sprintf(q, "CREATE %s INDEX \"%s\" on \"%s\" using %s (",
(strcmp(indinfo[i].indisunique, "t") == 0) ? "UNIQUE" : "",
fmtId(indinfo[i].indexrelname),
fmtId(indinfo[i].indrelname),
indinfo[i].indamname);
if (funcname)
{
! sprintf(q, "%s %s (%s) \"%s\" );\n",
q, funcname, attlist, fmtId(classname[0]));
free(funcname);
free(classname[0]);
--- 2668,2681 ----
if (!tablename || (!strcmp(indinfo[i].indrelname, tablename)))
{
! sprintf(q, "CREATE %s INDEX %s on %s using %s (",
(strcmp(indinfo[i].indisunique, "t") == 0) ? "UNIQUE" : "",
fmtId(indinfo[i].indexrelname),
fmtId(indinfo[i].indrelname),
indinfo[i].indamname);
if (funcname)
{
! sprintf(q, "%s %s (%s) %s );\n",
q, funcname, attlist, fmtId(classname[0]));
free(funcname);
free(classname[0]);
***************
*** 2892,2898 ****
sprintf(query,
"SELECT sequence_name, last_value, increment_by, max_value, "
! "min_value, cache_value, is_cycled, is_called from \"%s\"",
fmtId(tbinfo.relname));
res = PQexec(g_conn, query);
--- 2892,2898 ----
sprintf(query,
"SELECT sequence_name, last_value, increment_by, max_value, "
! "min_value, cache_value, is_cycled, is_called from %s",
fmtId(tbinfo.relname));
res = PQexec(g_conn, query);
***************
*** 2931,2937 ****
PQclear(res);
sprintf(query,
! "CREATE SEQUENCE \"%s\" start %d increment %d maxvalue %d "
"minvalue %d cache %d %s;\n",
fmtId(tbinfo.relname), last, incby, maxv, minv, cache,
(cycled == 't') ? "cycle" : "");
--- 2931,2937 ----
PQclear(res);
sprintf(query,
! "CREATE SEQUENCE %s start %d increment %d maxvalue %d "
"minvalue %d cache %d %s;\n",
fmtId(tbinfo.relname), last, incby, maxv, minv, cache,
(cycled == 't') ? "cycle" : "");
pgsql-hackers by date: