1)
"Create view" simple store where condition in internal structure ?
If later I run select * from view - all my where condition recheck
again ?
I believe the where is ignored when creating the view. Those conditions
will not be remembered and applied when you later run the select.
3) How about new key for psql - \dt \di \dv - show ONLY table or ONLY
index or ONLY view. I have, for example, ~80 objects in one base.
I know, I can say
SELECT usename, relname, relkind, relhasrules FROM pg_class, pg_user
WHERE ( relkind = 'r' OR relkind = 'i') and relname !~ '^pg_' and
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
relname !~ '^Inv[0-9]+' and usesysid = relowner and ORDER BY relname
I hate to post stuff up here untried, but I haven't the time _right_ now,
but will try it before I leave tonite. Here's a quick hack at it in psql.c...


*** psql.c Tue Mar 18 16:56:26 1997
- --- psql_org.c Tue Mar 18 16:45:54 1997
***************
*** 76,82 ****
static void
handleCopyIn(PGresult * res, const bool mustprompt,
FILE * copystream);
! static int tableList(PsqlSettings * ps, bool deep_tablelist, char table_index_both);
static int tableDesc(PsqlSettings * ps, char *table);

char *gets_noreadline(char *prompt, FILE * source);
- --- 76,82 ----
static void
handleCopyIn(PGresult * res, const bool mustprompt,
FILE * copystream);
! static int tableList(PsqlSettings * ps, bool deep_tablelist);
static int tableDesc(PsqlSettings * ps, char *table);

char *gets_noreadline(char *prompt, FILE * source);
***************
*** 214,220 ****
*
*/
int
! tableList(PsqlSettings * ps, bool deep_tablelist, char table_index_both)
{
char listbuf[256];
int nColumns;
- --- 214,220 ----
*
*/
int
! tableList(PsqlSettings * ps, bool deep_tablelist)
{
char listbuf[256];
int nColumns;
***************
*** 227,241 ****
listbuf[0] = '\0';
strcat(listbuf, "SELECT usename, relname, relkind, relhasrules");
strcat(listbuf, " FROM pg_class, pg_user ");
! switch (table_index_both) {
! case 't': strcat(listbuf, "WHERE ( relkind = 'r') ");
! break;
! case 'i':i strcat(listbuf, "WHERE ( relkind = 'i') ");
! break;
! case 'b':
! default: strcat(listbuf, "WHERE ( relkind = 'r' OR relkind = 'i') ");
! break;
! }
strcat(listbuf, " and relname !~ '^pg_'");
strcat(listbuf, " and relname !~ '^Inv[0-9]+'");
/*
- --- 227,233 ----
listbuf[0] = '\0';
strcat(listbuf, "SELECT usename, relname, relkind, relhasrules");
strcat(listbuf, " FROM pg_class, pg_user ");
! strcat(listbuf, "WHERE ( relkind = 'r' OR relkind = 'i') ");
strcat(listbuf, " and relname !~ '^pg_'");
strcat(listbuf, " and relname !~ '^Inv[0-9]+'");
/*
***************
*** 1049,1064 ****
}
break;
case 'd': /* \d describe tables or columns in a table */
! if (strncmp(cmd, "dt") == 0) { /* only tables */
! tableList(settings, 0, 't');
! } else if (strncmp(cmd, "di") == 0) { /* only tables */
! tableList(settings, 0, 'i');
! } else if (!optarg) { /* show'em both */
! tableList(settings, 0, 'b');
! } else if (strcmp(optarg, "*") == 0) { /* show everything */
! tableList(settings, 0, 'b');
! tableList(settings, 1, 'b');
! } else { /* describe the specified table */
tableDesc(settings, optarg);
}
break;
- --- 1041,1054 ----
}
break;
case 'd': /* \d describe tables or columns in a table */
! if (!optarg) {
! tableList(settings, 0);
! break;
! }
! if (strcmp(optarg, "*") == 0) {
! tableList(settings, 0);
! tableList(settings, 1);
! } else {
tableDesc(settings, optarg);
}
break;

------------------------------

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 2 | next ›
Discussion Overview
grouppgsql-hackers @
categoriespostgresql
postedMar 18, '97 at 6:38p
activeMar 18, '97 at 10:04p
posts2
users2
websitepostgresql.org...
irc#postgresql

2 users in discussion

Maxim Kozin: 1 post Darren King: 1 post

People

Translate

site design / logo © 2021 Grokbase