mirror of
https://github.com/postgres/postgres.git
synced 2025-07-14 08:21:07 +03:00
> > > This patches src/bin/psql/psql.c.
> > > > > > This patch is in responce to the following TODO list item: > > > * have psql \d on a view show the query > > > -Ryan
This commit is contained in:
@ -111,7 +111,7 @@ textnlike(struct varlena * s, struct varlena * p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* $Revision: 1.21 $
|
/* $Revision: 1.22 $
|
||||||
** "like.c" A first attempt at a LIKE operator for Postgres95.
|
** "like.c" A first attempt at a LIKE operator for Postgres95.
|
||||||
**
|
**
|
||||||
** Originally written by Rich $alz, mirror!rs, Wed Nov 26 19:03:17 EST 1986.
|
** Originally written by Rich $alz, mirror!rs, Wed Nov 26 19:03:17 EST 1986.
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.171 1999/02/21 03:49:39 scrappy Exp $
|
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.172 1999/03/15 02:18:37 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -761,10 +761,34 @@ tableDesc(PsqlSettings *pset, char *table, FILE *fout)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Display the information
|
* Extract the veiw name and veiw definition from pg_views.
|
||||||
|
* -Ryan 2/14/99
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
descbuf[0] = '\0';
|
||||||
|
strcat(descbuf, "SELECT viewname, definition ");
|
||||||
|
strcat(descbuf, "FROM pg_views ");
|
||||||
|
strcat(descbuf, "WHERE viewname like '");
|
||||||
|
strcat(descbuf, table);
|
||||||
|
strcat(descbuf, "' ");
|
||||||
|
if(!(res2 = PSQLexec(pset, descbuf)))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Display the information
|
||||||
|
*/
|
||||||
|
if(PQntuples(res2)) {
|
||||||
|
/*
|
||||||
|
* display the query.
|
||||||
|
* -Ryan 2/14/99
|
||||||
|
*/
|
||||||
|
fprintf(fout, "\nView = %s\n", table);
|
||||||
|
fprintf(fout, "Query = %s\n", PQgetvalue(res2, 0, 1));
|
||||||
|
} else {
|
||||||
fprintf(fout, "\nTable = %s\n", table);
|
fprintf(fout, "\nTable = %s\n", table);
|
||||||
|
}
|
||||||
|
PQclear(res2);
|
||||||
|
|
||||||
fprintf(fout, "+----------------------------------+----------------------------------+-------+\n");
|
fprintf(fout, "+----------------------------------+----------------------------------+-------+\n");
|
||||||
fprintf(fout, "| Field | Type | Length|\n");
|
fprintf(fout, "| Field | Type | Length|\n");
|
||||||
fprintf(fout, "+----------------------------------+----------------------------------+-------+\n");
|
fprintf(fout, "+----------------------------------+----------------------------------+-------+\n");
|
||||||
|
Reference in New Issue
Block a user