Thread: Re: [GENERAL] translate "bug"?

Re: [GENERAL] translate "bug"?

From
Stuart Rison
Date:
>> I have some embedded spaces in data that should be stripped out.
>>
>> In the course of trying to find a way to do this, I found out some stuff:
>>
>> #1a
>> \df would be a whole lot nicer if I could do:
>>
>> \df <type>    and get only functions that have the given return type, or
>> \df <string>  it grepped all the lines for something matching string
>>
>
>Try:
>
>   echo "\df" | psql | grep <type>
>
>or
>
>   echo "\df" | psql | grep <string>
>
>I realize you want it inside the psql program, but the above should get the
>same results pretty quick...james

Thanks for that James... I've been trying to work out how to do it for ages!

I have to agree with Richard though, it would be very nice to have it
within psql.  Furthermore, it would be great if such functionality
could be extended to all \d? queries.  In fact, and I'm sure there actually
is a way to this if you're more knowledgeable than I, since most of these
\d? queries basically yield a 'SQL' table, wouldn't be nice to be able to
perform SQL on the  (e.g. select * from \df where function = 'int2_text';
etc.)

Or am I just getting carried away! 8)

Stuart


+-------------------------+--------------------------------------+
| Stuart Rison            | Ludwig Institute for Cancer Research |
+-------------------------+ University College London            |
| Tel. (0171) 878 4041    | 91 Riding House Street               |
| Fax. (0171) 878 4040    | London, W1P 8BT, UNITED KINGDOM.     |
+-------------------------+--------------------------------------+
| stuart@NOJUNK_ludwig.ucl.ac.uk [Remove NOJUNK_ for it to work] |
+----------------------------------------------------------------+



Re: [GENERAL] translate "bug"?

From
James Olin Oden
Date:
> Thanks for that James... I've been trying to work out how to do it for ages!
>
> I have to agree with Richard though, it would be very nice to have it
> within psql.  Furthermore, it would be great if such functionality
> could be extended to all \d? queries.  In fact, and I'm sure there actually
> is a way to this if you're more knowledgeable than I, since most of these
> \d? queries basically yield a 'SQL' table, wouldn't be nice to be able to
> perform SQL on the  (e.g. select * from \df where function = 'int2_text';
> etc.)
>
> Or am I just getting carried away! 8)
>

You know, I think there might be a way to do that, because I believe in some SQL
Databases, you can actually do queries against the catalogs; perhaps you can do
that with Postgress.  I don't know for sure though...james


Re: [GENERAL] translate "bug"?

From
Bruce Momjian
Date:
> >I realize you want it inside the psql program, but the above should get the
> >same results pretty quick...james
>
> Thanks for that James... I've been trying to work out how to do it for ages!

I will look into implementing \df kjasdf, and do it as a regex!


>
> I have to agree with Richard though, it would be very nice to have it
> within psql.  Furthermore, it would be great if such functionality
> could be extended to all \d? queries.  In fact, and I'm sure there actually
> is a way to this if you're more knowledgeable than I, since most of these
> \d? queries basically yield a 'SQL' table, wouldn't be nice to be able to
> perform SQL on the  (e.g. select * from \df where function = 'int2_text';
> etc.)
>
> Or am I just getting carried away! 8)

That is a little strange.


--
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)

Re: [GENERAL] translate "bug"?

From
Stuart Rison
Date:
Yeah, I've rethough about it and it does seem a bit out-there ;) ... I'm
sure there was one time where I encountered a situation where you would
want to use the \d? commands in an SQL statement environment but I can't
even begin to remember... so maybe it wasn't that important afterall and
regex'ing will do just fine.

I do feel though that the \df <regex> functionality would be useful in
other catalog queries (thank james, I didn't know that what they were
called) e.g. \do <regex> or \dt <regex> (which would get you all tables
containing <regex> e.g. titles, tileauthors, titleditors etc, as opposed to
\d titles which would get you just table titles).

or am I being dim again? [that dreaded feeling of posting something really
stupid...]

Cheers,

S.

>> >I realize you want it inside the psql program, but the above should get the
>> >same results pretty quick...james
>>
>> Thanks for that James... I've been trying to work out how to do it for ages!
>
>I will look into implementing \df kjasdf, and do it as a regex!


>
>>
>> I have to agree with Richard though, it would be very nice to have it
>> within psql.  Furthermore, it would be great if such functionality
>> could be extended to all \d? queries.  In fact, and I'm sure there actually
>> is a way to this if you're more knowledgeable than I, since most of these
>> \d? queries basically yield a 'SQL' table, wouldn't be nice to be able to
>> perform SQL on the  (e.g. select * from \df where function = 'int2_text';
>> etc.)
>>
>> Or am I just getting carried away! 8)
>
>That is a little strange.
>




+-------------------------+--------------------------------------+
| Stuart Rison            | Ludwig Institute for Cancer Research |
+-------------------------+ University College London            |
| Tel. (0171) 878 4041    | 91 Riding House Street               |
| Fax. (0171) 878 4040    | London, W1P 8BT, UNITED KINGDOM.     |
+-------------------------+--------------------------------------+
| stuart@NOJUNK_ludwig.ucl.ac.uk [Remove NOJUNK_ for it to work] |
+----------------------------------------------------------------+



Re: [GENERAL] translate "bug"?

From
Herouth Maoz
Date:
At 14:36 +0300 on 8/7/98, Stuart Rison wrote:


> Yeah, I've rethough about it and it does seem a bit out-there ;) ... I'm
> sure there was one time where I encountered a situation where you would
> want to use the \d? commands in an SQL statement environment but I can't
> even begin to remember... so maybe it wasn't that important afterall and
> regex'ing will do just fine.
>
> I do feel though that the \df <regex> functionality would be useful in
> other catalog queries (thank james, I didn't know that what they were
> called) e.g. \do <regex> or \dt <regex> (which would get you all tables
> containing <regex> e.g. titles, tileauthors, titleditors etc, as opposed to
> \d titles which would get you just table titles).

In my (humble?) opinion, instead of having this as a specialized command in
psql, there should rather have been a read-only view in the system which
would make it possible to look at only part of the information.

This would make the information readily available from other interfaces
beside psql, and will not force the interface developers to rely on "inside
information" telling them which tables to query and what the internal oids
are to look for. Thus, if internal things like that are changed, the view
would stay alive and easily accessible.

So, instead of \d we would have something like SELECT * from SYSRELS_VIEW.
And instead of \dt, SELECT * from SYSRELS_VIEW WHERE relation_type =
'table' (which would imply that the view will have this in ascii, where the
internal table has it in some coding). Instead of \d my_table, we'll have
SELECT * from SYSCOLS_VIEW WHERE relation = 'my_table';

I think that's more or less how it's done in Oracle and the like, isn't it?
And it relies only on something we all know - SQL queries.

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma



Re: [GENERAL] translate "bug"?

From
Bruce Momjian
Date:
> Yeah, I've rethough about it and it does seem a bit out-there ;) ... I'm
> sure there was one time where I encountered a situation where you would
> want to use the \d? commands in an SQL statement environment but I can't
> even begin to remember... so maybe it wasn't that important afterall and
> regex'ing will do just fine.
>
> I do feel though that the \df <regex> functionality would be useful in
> other catalog queries (thank james, I didn't know that what they were
> called) e.g. \do <regex> or \dt <regex> (which would get you all tables
> containing <regex> e.g. titles, tileauthors, titleditors etc, as opposed to
> \d titles which would get you just table titles).
>
> or am I being dim again? [that dreaded feeling of posting something really
> stupid...]

I think these are good ideas.  I will implement them for 6.4.  Glad you
are using the new features.

--
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)