mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-21 08:29:39 +08:00
Make no-tty not use quiet in psql, fix group by copy failure, fix ccsym to delete tmp files.
This commit is contained in:
parent
6b2e7e12be
commit
bbd5c21786
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.23 1997/12/23 19:53:30 thomas Exp $
|
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.24 1997/12/23 21:38:25 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -509,6 +509,21 @@ _copyAgg(Agg *from)
|
|||||||
return newnode;
|
return newnode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ---------------
|
||||||
|
* _copyGroupClause
|
||||||
|
* --------------
|
||||||
|
*/
|
||||||
|
static GroupClause *
|
||||||
|
_copyGroupClause(GroupClause *from)
|
||||||
|
{
|
||||||
|
GroupClause *newnode = makeNode(GroupClause);
|
||||||
|
|
||||||
|
newnode->grpOpoid = from->grpOpoid;
|
||||||
|
newnode->entry = copyObject(from->entry);
|
||||||
|
|
||||||
|
return newnode;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ----------------
|
/* ----------------
|
||||||
* _copyUnique
|
* _copyUnique
|
||||||
@ -1665,6 +1680,9 @@ copyObject(void *from)
|
|||||||
case T_Agg:
|
case T_Agg:
|
||||||
retval = _copyAgg(from);
|
retval = _copyAgg(from);
|
||||||
break;
|
break;
|
||||||
|
case T_GroupClause:
|
||||||
|
retval = _copyGroupClause(from);
|
||||||
|
break;
|
||||||
case T_Unique:
|
case T_Unique:
|
||||||
retval = _copyUnique(from);
|
retval = _copyUnique(from);
|
||||||
break;
|
break;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.121 1997/12/22 20:03:53 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.122 1997/12/23 21:38:40 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -110,7 +110,7 @@ struct winsize
|
|||||||
/* declarations for functions in this file */
|
/* declarations for functions in this file */
|
||||||
static void usage(char *progname);
|
static void usage(char *progname);
|
||||||
static void slashUsage();
|
static void slashUsage();
|
||||||
static void handleCopyOut(PGresult *res, bool quiet, FILE *copystream);
|
static void handleCopyOut(PGresult *res, FILE *copystream);
|
||||||
static void
|
static void
|
||||||
handleCopyIn(PGresult *res, const bool mustprompt,
|
handleCopyIn(PGresult *res, const bool mustprompt,
|
||||||
FILE *copystream);
|
FILE *copystream);
|
||||||
@ -994,13 +994,13 @@ SendQuery(bool *success_p, PsqlSettings *pset, const char *query,
|
|||||||
case PGRES_COPY_OUT:
|
case PGRES_COPY_OUT:
|
||||||
*success_p = true;
|
*success_p = true;
|
||||||
if (copy_out)
|
if (copy_out)
|
||||||
handleCopyOut(results, pset->quiet, copystream);
|
handleCopyOut(results, copystream);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!pset->quiet)
|
if (!pset->quiet)
|
||||||
printf("Copy command returns...\n");
|
printf("Copy command returns...\n");
|
||||||
|
|
||||||
handleCopyOut(results, pset->quiet, stdout);
|
handleCopyOut(results, stdout);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PGRES_COPY_IN:
|
case PGRES_COPY_IN:
|
||||||
@ -1008,7 +1008,7 @@ SendQuery(bool *success_p, PsqlSettings *pset, const char *query,
|
|||||||
if (copy_in)
|
if (copy_in)
|
||||||
handleCopyIn(results, false, copystream);
|
handleCopyIn(results, false, copystream);
|
||||||
else
|
else
|
||||||
handleCopyIn(results, !pset->quiet, stdin);
|
handleCopyIn(results, !pset->quiet && !pset->notty, stdin);
|
||||||
break;
|
break;
|
||||||
case PGRES_NONFATAL_ERROR:
|
case PGRES_NONFATAL_ERROR:
|
||||||
case PGRES_FATAL_ERROR:
|
case PGRES_FATAL_ERROR:
|
||||||
@ -2548,7 +2548,7 @@ main(int argc, char **argv)
|
|||||||
#define COPYBUFSIZ 8192
|
#define COPYBUFSIZ 8192
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handleCopyOut(PGresult *res, bool quiet, FILE *copystream)
|
handleCopyOut(PGresult *res, FILE *copystream)
|
||||||
{
|
{
|
||||||
bool copydone;
|
bool copydone;
|
||||||
char copybuf[COPYBUFSIZ];
|
char copybuf[COPYBUFSIZ];
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
trap "/bin/rm -f /tmp/$$.*" 0 1 2 3 15
|
trap "/bin/rm -f /tmp/$$.*" 0 1 2 3 15
|
||||||
|
cd /tmp
|
||||||
/bin/cat >$$.c <<EOF
|
/bin/cat >$$.c <<EOF
|
||||||
extern int foo;
|
extern int foo;
|
||||||
EOF
|
EOF
|
||||||
|
Loading…
Reference in New Issue
Block a user