Skip Menu |

This queue is for tickets about the DBI-Shell CPAN distribution.

Report information
The Basics
Id: 24539
Status: open
Priority: 0/
Queue: DBI-Shell

People
Owner: Nobody in particular
Requestors: hjp [...] hjp.at
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 11.93
Fixed in: (no value)



Subject: /describe doesn't work with DBI 1.40 and DBD::Oracle 1.19
The /describe command always returns an empty result set [0 rows of 9 fields returned] regardless of whether the table exists or not.
From: hjp [...] hjp.at
On Mi. 24. Jan. 2007, 04:24:11, hjp@hjp.at wrote: Show quoted text
> The /describe command always returns an empty result set [0 rows of 9 > fields returned] regardless of whether the table exists or not.
This is probably a duplicate of bug #15631, although the symptoms are a bit different (Sorry, I missed that one).
From: hjp [...] hjp.at
On Mi. 24. Jan. 2007, 04:24:11, hjp@hjp.at wrote: Show quoted text
> The /describe command always returns an empty result set [0 rows of 9 > fields returned] regardless of whether the table exists or not.
Actually, it does work - you just need to give the table name in upper case.
On Wed Jan 24 04:59:26 2007, hjp@hjp.at wrote: Show quoted text
> On Mi. 24. Jan. 2007, 04:24:11, hjp@hjp.at wrote:
> > The /describe command always returns an empty result set [0 rows of 9 > > fields returned] regardless of whether the table exists or not.
> > Actually, it does work - you just need to give the table name in upper case.
I don't have an Oracle system to test against. Is this something which can be fixed in DBI::Shell, or is it that Oracle table names are canonically in capitals?
Subject: Re: [rt.cpan.org #24539] /describe doesn't work with DBI 1.40 and DBD::Oracle 1.19
Date: Sun, 10 Nov 2019 10:19:05 -0500
To: bug-DBI-Shell [...] rt.cpan.org
From: Thomas Lowery <talowery [...] gmail.com>
Dave, I just had a tumor removed from my brain. Not sure when I'll be back working. Tom On Sun, Nov 10, 2019, 09:28 Dave Lambley via RT <bug-DBI-Shell@rt.cpan.org> wrote: Show quoted text
> Queue: DBI-Shell > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=24539 > > > On Wed Jan 24 04:59:26 2007, hjp@hjp.at wrote:
> > On Mi. 24. Jan. 2007, 04:24:11, hjp@hjp.at wrote:
> > > The /describe command always returns an empty result set [0 rows of 9 > > > fields returned] regardless of whether the table exists or not.
> > > > Actually, it does work - you just need to give the table name in upper
> case. > > I don't have an Oracle system to test against. Is this something which can > be fixed in DBI::Shell, or is it that Oracle table names are canonically in > capitals? >
Subject: Re: [rt.cpan.org #24539] /describe doesn't work with DBI 1.40 and DBD::Oracle 1.19
Date: Sun, 10 Nov 2019 20:04:19 +0100
To: Dave Lambley via RT <bug-DBI-Shell [...] rt.cpan.org>
From: "Peter J. Holzer" <hjp [...] hjp.at>
On 2019-11-10 09:28:13 -0500, Dave Lambley via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=24539 > > > On Wed Jan 24 04:59:26 2007, hjp@hjp.at wrote:
^^^^ Hey, I'm getting nostalgic :-) Show quoted text
> > On Mi. 24. Jan. 2007, 04:24:11, hjp@hjp.at wrote:
> > > The /describe command always returns an empty result set [0 rows of 9 > > > fields returned] regardless of whether the table exists or not.
> > > > Actually, it does work - you just need to give the table name in upper case.
> > I don't have an Oracle system to test against. Is this something which > can be fixed in DBI::Shell, or is it that Oracle table names are > canonically in capitals?
Oracle table names are canonically in capitals. A case insensitive lookup would be nice (it seems weird that you can write "select * from foo;" but need to write "/describe FOO", but then Oracle's information views aren't case insensitive either (you have to write something like "select * from user_tables where table_name = 'FOO'"), so I guess one gets used to it. hp -- _ | Peter J. Holzer | Story must make more sense than reality. |_|_) | | | | | hjp@hjp.at | -- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!"
Download signature.asc
application/pgp-signature 833b

Message body not shown because it is not plain text.

RT-Send-CC: talowery [...] gmail.com
Hi Tom, Thank you for your message. Wishing you all the best! I ended up using DBI::Shell for working with a in-house database. I have collected together some of the accumulated patches and made a few tidy-ups, including removing the warning of rapid development and interface instability! I'll do a proper release soon. Best regards, Dave On Sun Nov 10 10:19:35 2019, TLOWERY wrote: Show quoted text
> Dave, > I just had a tumor removed from my brain. Not sure when I'll be back > working. > > Tom > > On Sun, Nov 10, 2019, 09:28 Dave Lambley via RT <bug-DBI- > Shell@rt.cpan.org> > wrote: >
> > Queue: DBI-Shell > > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=24539 > > > > > On Wed Jan 24 04:59:26 2007, hjp@hjp.at wrote:
> > > On Mi. 24. Jan. 2007, 04:24:11, hjp@hjp.at wrote:
> > > > The /describe command always returns an empty result set [0 rows > > > > of 9 > > > > fields returned] regardless of whether the table exists or not.
> > > > > > Actually, it does work - you just need to give the table name in > > > upper
> > case. > > > > I don't have an Oracle system to test against. Is this something > > which can > > be fixed in DBI::Shell, or is it that Oracle table names are > > canonically in > > capitals? > >
RT-Send-CC: hjp [...] hjp.at
On Sun Nov 10 14:12:18 2019, hjp@hjp.at wrote: Show quoted text
> On 2019-11-10 09:28:13 -0500, Dave Lambley via RT wrote:
> > <URL: https://rt.cpan.org/Ticket/Display.html?id=24539 > > > > > On Wed Jan 24 04:59:26 2007, hjp@hjp.at wrote:
> ^^^^ > Hey, I'm getting nostalgic :-) >
> > > On Mi. 24. Jan. 2007, 04:24:11, hjp@hjp.at wrote:
> > > > The /describe command always returns an empty result set [0 rows > > > > of 9 > > > > fields returned] regardless of whether the table exists or not.
> > > > > > Actually, it does work - you just need to give the table name in > > > upper case.
> > > > I don't have an Oracle system to test against. Is this something > > which > > can be fixed in DBI::Shell, or is it that Oracle table names are > > canonically in capitals?
> > Oracle table names are canonically in capitals. > > A case insensitive lookup would be nice (it seems weird that you can > write "select * from foo;" but need to write "/describe FOO", but then > Oracle's information views aren't case insensitive either (you have to > write something like "select * from user_tables where table_name = > 'FOO'"), so I guess one gets used to it. > > hp
Wow, I didn't notice quite how old this ticket is! Thank you for the information Peter. Perhaps the thing to do would be to make DBI::Shell emit a warning if you're using DBD::Oracle and you give a table name that's not upper case? That seems preferable to magically fixing the case, which could be misleading. I would get stuck in and do this, but have no means to test (and nor am I likely to use Oracle in the near future!) I shall leave this ticket here for anyone motivated to take a look.
Subject: Re: [rt.cpan.org #24539] /describe doesn't work with DBI 1.40 and DBD::Oracle 1.19
Date: Sat, 16 Nov 2019 11:40:40 +0100
To: Dave Lambley via RT <bug-DBI-Shell [...] rt.cpan.org>
From: "Peter J. Holzer" <hjp [...] hjp.at>
On 2019-11-12 17:25:05 -0500, Dave Lambley via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=24539 > > On Sun Nov 10 14:12:18 2019, hjp@hjp.at wrote:
> > On 2019-11-10 09:28:13 -0500, Dave Lambley via RT wrote:
> > > On Wed Jan 24 04:59:26 2007, hjp@hjp.at wrote:
> > > > On Mi. 24. Jan. 2007, 04:24:11, hjp@hjp.at wrote:
> > > > > The /describe command always returns an empty result set [0 > > > > > rows of 9 fields returned] regardless of whether the table > > > > > exists or not.
> > > > > > > > Actually, it does work - you just need to give the table name in > > > > upper case.
[...] Show quoted text
> Perhaps the thing to do would be to make DBI::Shell emit a warning if > you're using DBD::Oracle and you give a table name that's not upper > case? That seems preferable to magically fixing the case, which could > be misleading.
Databases like Oracle or PostgreSQL actually convert the case of unquoted identifiers (so «select * from Foo» is treated like «select * from "FOO"» or «select * from "foo"» respectively) and one could expect that /describe does the same. However, I don't think there is any way to get this information out of DBI, so I guess you are right: Printing a warning (probably only if the table isn't found) is better. There should be a better way than hardcoding a check for DBD::Oracle, though. One idea I had was to compute stats over the result of $dbh->table_info("%", "%", "%", "TABLE") If 90+ % are upper case the database probably defaults to upper case, if 90+% are lower case, it's lower case and between those we don't know. However, while writing this, I had a different idea: Instead of trying to determine this globally, try to find a matching table if the table requested by the user doesn't exist. So if the user types «/describe Foo» and "Foo" doesn't exist, but "FOO" or "foo" does, print an error message and the hint «Did you mean "FOO"?» (or "foo"). This could check for other typos, too («/describe eaxmple» -> «Did you mean "example"?»). I just noticed that /describe isn't described in the current man-page. Is/was this even part of the core or in a plugin? I have to admit I haven't used DBI::Shell in several years. I'm mostly using PostgreSQL now, and psql is a fine sql shell (unlike Oracle's sqlplus, which is quite horrible). Show quoted text
> I would get stuck in and do this, but have no means to > test (and nor am I likely to use Oracle in the near future!)
I still have one Oracle database, so I can test. hp -- _ | Peter J. Holzer | Story must make more sense than reality. |_|_) | | | | | hjp@hjp.at | -- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!"
Download signature.asc
application/pgp-signature 833b

Message body not shown because it is not plain text.