pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Pattern with backslash commands in psql terminal
3+ messages / 2 participants
[nested] [flat]

* Pattern with backslash commands in psql terminal
@ 2006-05-23 18:03 Rolf Unger <rolf.unger@ctilabs.de>
  2006-05-23 18:36 ` Re: Pattern with backslash commands in psql terminal Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 3+ messages in thread

From: Rolf Unger @ 2006-05-23 18:03 UTC (permalink / raw)
  To: pgsql-docs

Hi Folks,

actually I am not sure if this is the right mailing list, although I am
quite sure that this is a documenation issue:

I want to list the functions that are defined in a database and tried to
use the internal \df command of the psql terminal (I use emacs so I
don't need pgAdmin). Of course I don't want to see all internal function
like substr(), cast(), ..., but only those that were created by myself
some weeks ago.

The internal docs say that I can specify an optional pattern after the
\df or the \df+. And I think I read somewhere that the pattern is meant
to be a regular expression. So wildcards should rather be .* or [a-z]+
and not the typical shell wildcards ? or *.
But I had no success in either way. And using SQL wildcards % or _
doesn't work as well. "No success" means: The returned list is empty.
And I didn't find more detailed information anywhere in the docs.

Only if I use the full function name as pattern, then one row with the
function is returned. But that is useless, because my starting point is
usually: "What's the exact name of this function again? It started with
'my_' but was it 'export' or 'exp' after the prefix?"

 \df my_                --> no rows
 \df "my_.*"            --> no rows
 \df /my_.*/            --> no rows
 \df "my_*"             --> no rows
 \df 'my%'              --> no rows
 
 \df my_export          --> (1 row)

Are there some special delimiters required? It would be really a good
thing to have at least a comment or a footnote with any one of the \d
commands what kind of syntax is needed for the [PATTERN].
An example would surely be a good idea as well.

Thanks, Rolf.



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Pattern with backslash commands in psql terminal
  2006-05-23 18:03 Pattern with backslash commands in psql terminal Rolf Unger <rolf.unger@ctilabs.de>
@ 2006-05-23 18:36 ` Tom Lane <tgl@sss.pgh.pa.us>
  2006-05-24 08:36   ` Re: Pattern with backslash commands in psql terminal Rolf Unger <rolf.unger@ctilabs.de>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2006-05-23 18:36 UTC (permalink / raw)
  To: rolf.unger@ctilabs.de; +Cc: pgsql-docs

Rolf Unger <rolf.unger@ctilabs.de> writes:
> The internal docs say that I can specify an optional pattern after the
> \df or the \df+. And I think I read somewhere that the pattern is meant
> to be a regular expression.

No, it's more a shell-style pattern.  Use "*" and "?".  "." separates
schema and object name parts of the pattern.

> Are there some special delimiters required? It would be really a good
> thing to have at least a comment or a footnote with any one of the \d
> commands what kind of syntax is needed for the [PATTERN].

Did you read the material at the bottom of the backslash command list?


The various \d commands accept a pattern parameter to specify the object name(s) to be displayed. * means "any
sequence of characters" and ? means "any single character". (This notation is comparable to Unix shell file name
patterns.) Advanced users can also use regular-expression notations such as character classes, for example [0-9] to
match "any digit". To make any of these pattern-matching characters be interpreted literally, surround it with double
quotes. 

A pattern that contains an (unquoted) dot is interpreted as a schema name pattern followed by an object name pattern. For
example, \dt foo*.bar* displays all tables in schemas whose name starts with foo and whose table name starts with
bar. If no dot appears, then the pattern matches only objects that are visible in the current schema search path. 

Whenever the pattern parameter is omitted completely, the \d commands display all objects that are visible in the
current schema search path. To see all objects in the database, use the pattern *.*. 

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Pattern with backslash commands in psql terminal
  2006-05-23 18:03 Pattern with backslash commands in psql terminal Rolf Unger <rolf.unger@ctilabs.de>
  2006-05-23 18:36 ` Re: Pattern with backslash commands in psql terminal Tom Lane <tgl@sss.pgh.pa.us>
@ 2006-05-24 08:36   ` Rolf Unger <rolf.unger@ctilabs.de>
  0 siblings, 0 replies; 3+ messages in thread

From: Rolf Unger @ 2006-05-24 08:36 UTC (permalink / raw)
  To: pgsql-docs; +Cc: Tom Lane <tgl@sss.pgh.pa.us>

Okay,

I've found it in the man page. I guess I just don't expected it to come
after all these other \x, \? descriptions.

Thanks that you pointed me to the right location.

Rolf.



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2006-05-24 08:36 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-05-23 18:03 Pattern with backslash commands in psql terminal Rolf Unger <rolf.unger@ctilabs.de>
2006-05-23 18:36 ` Tom Lane <tgl@sss.pgh.pa.us>
2006-05-24 08:36   ` Rolf Unger <rolf.unger@ctilabs.de>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox