dbTalk Databases Forums  

[BUGS] Fwd: postgresql-autodoc - missinterprets "version"

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] Fwd: postgresql-autodoc - missinterprets "version" in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Martin Pitt
 
Posts: n/a

Default [BUGS] Fwd: postgresql-autodoc - missinterprets "version" - 07-08-2004 , 08:56 AM






--zYM0uCDKw75PZbzx
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi PostgreSQL developers!

Recently we got the bug report below. It seems that there is a special
treatment of columns named "version". Normally fields of primary key
indices are printed out unquoted, however, if the column is named
"version", the name is printed out in quotes.=20

This behaviour seems to confuse PostgreSQL autotoc.

Does this behaviour serve any purpose or it is an error?

Thanks and have a nice day!

Martin

----- Forwarded message from Bastian Blank <waldi (AT) debian (DOT) org> -----

Date: Sat, 29 May 2004 17:17:42 +0200
From: Bastian Blank <waldi (AT) debian (DOT) org>
To: submit (AT) bugs (DOT) debian.org
Subject: postgresql-autodoc - missinterprets "version"
X-Spam-Status: No, hits=3D-7.0 required=3D4.0 tests=3DBAYES_01,HAS_PACKAGE=
=20
autolearn=3Dno version=3D2.60-bugs.debian.org_2004_03_25

Package: postgresql-autodoc
Version: 1.22-2
Severity: normal

postgresql_autodoc missinterprets fields with name "version", as
postgresql sometimes reports version, sometimes "version".

Quote:
F-Key Name Type Description
"version" UNIQUE#1
id serial PRIMARY KEY
package.version.id version integer NOT NULL
package.binarypackage_name.id binarypackage_name integer UNIQUE#1 NO=
T NULL

Bastian

--=20
Military secrets are the most fleeting of all.
-- Spock, "The Enterprise Incident", stardate 5027.4



----- End forwarded message -----
----- Forwarded message from Tommaso Moroni <moronito (AT) debian (DOT) org> -----

Date: Mon, 31 May 2004 20:43:08 +0200
From: Tommaso Moroni <moronito (AT) debian (DOT) org>
To: 251595 (AT) bugs (DOT) debian.org
Subject: Re: Processed: reassigning bug #251595 to postgresql package
Mail-Followup-To: 251595 (AT) bugs (DOT) debian.org
X-Spam-Status: No, hits=3D-3.0 required=3D4.0 tests=3DBAYES_00 autolearn=3D=
no=20
version=3D2.60-bugs.debian.org_2004_03_25

On Mon, May 31, 2004 at 06:09:58PM +0100, Oliver Elphick wrote:
Quote:
What SQL command produced these results?
Actually they are the postgresql-autodoc output. Here's what
I've tried:


test=3D> CREATE TABLE test (version smallint primary key);
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "test_pkey" =
for table "test"
CREATE TABLE
test=3D> \d test
Tabella "public.test"
Colonna | Tipo | Modificatori
---------+----------+--------------
version | smallint | not null
Indici:
"test_pkey" chiave primaria, btree ("version")


The strange thing is the last line. I also tried with different=20
field types and got the same results. However if the field name isn't
"version" there are no problem at all.


I hope it helps.
--=20
Tommaso Moroni
moronito (AT) debian (DOT) org



----- End forwarded message -----

--=20
Martin Pitt Debian GNU/Linux Developer
martin (AT) piware (DOT) de mpitt (AT) debian (DOT) org
http://www.piware.de http://www.debian.org

--zYM0uCDKw75PZbzx
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFA7U9GDecnbV4Fd/IRAhlEAJ4r08ij9T4jYIWyDLSbvjD5fUP7hgCfSPaE
D4epTahtaDN+Ksh6L8r0FE8=
=FreW
-----END PGP SIGNATURE-----

--zYM0uCDKw75PZbzx--


Reply With Quote
  #2  
Old   
Stephan Szabo
 
Posts: n/a

Default Re: [BUGS] Fwd: postgresql-autodoc - missinterprets "version" - 07-08-2004 , 09:17 AM







On Thu, 8 Jul 2004, Martin Pitt wrote:

Quote:
Hi PostgreSQL developers!

Recently we got the bug report below. It seems that there is a special
treatment of columns named "version". Normally fields of primary key
indices are printed out unquoted, however, if the column is named
"version", the name is printed out in quotes.

This behaviour seems to confuse PostgreSQL autotoc.

Does this behaviour serve any purpose or it is an error?
It doesn't appear to be necessary to quote the identifier, however version
and "version" refer to the same identifier in this case so I wouldn't call
it an error, either. My guess as to the reason comes from this comment
fragment in quote_identifier:

* Check for keyword. This test is overly strong, since many of
* the "keywords" known to the parser are usable as column names,
* but the parser doesn't provide any easy way to test for whether
* an identifier is safe or not... so be safe not sorry.

version is one of those keywords that are usable as column names I
believe.


---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend


Reply With Quote
  #3  
Old   
Martin Pitt
 
Posts: n/a

Default Re: [BUGS] Fwd: postgresql-autodoc - missinterprets "version" - 07-08-2004 , 10:09 AM



--oLBj+sq0vYjzfsbl
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi Stephan!

On 2004-07-08 7:10 -0700, Stephan Szabo wrote:
Quote:
It doesn't appear to be necessary to quote the identifier, however version
and "version" refer to the same identifier in this case so I wouldn't call
it an error, either. My guess as to the reason comes from this comment
fragment in quote_identifier:
=20
* Check for keyword. This test is overly strong, since many of
* the "keywords" known to the parser are usable as column names,
* but the parser doesn't provide any easy way to test for whether
* an identifier is safe or not... so be safe not sorry.
This makes sense, thank you. I reassigned this bug to
postgresql-autodoc. Just ignoring the quotes cannot be that
difficult...

Thanks and have a nice day!

Martin

--=20
Martin Pitt Debian GNU/Linux Developer
martin (AT) piware (DOT) de mpitt (AT) debian (DOT) org
http://www.piware.de http://www.debian.org

--oLBj+sq0vYjzfsbl
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFA7WHDDecnbV4Fd/IRAsqeAJ40XRRm7y2ECTOIo2Rt/ttPfqIE/wCfSKQp
tljAVFOjM19DoK8TFXzeLXg=
=QbZJ
-----END PGP SIGNATURE-----

--oLBj+sq0vYjzfsbl--


Reply With Quote
  #4  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] Fwd: postgresql-autodoc - missinterprets "version" - 07-09-2004 , 11:04 PM



Martin Pitt <martin (AT) piware (DOT) de> writes:
Quote:
On 2004-07-08 7:10 -0700, Stephan Szabo wrote:
It doesn't appear to be necessary to quote the identifier, however version
and "version" refer to the same identifier in this case so I wouldn't call
it an error, either.

This makes sense, thank you. I reassigned this bug to
postgresql-autodoc. Just ignoring the quotes cannot be that
difficult...
I am not sure why VERSION is a keyword, since AFAICS it is not used in
any production in gram.y. Also, I've been harboring thoughts of fixing
things so that quote_identifier wouldn't quote "unreserved" keywords.

But having said that, it's surely postgresql-autodoc's fault that it
cannot cope with quoted identifiers. There *will* be cases where PK
field names are quoted, such as mixed-case identifiers --- you do not
need a keyword collision to make that happen.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.