Re: PGAdmin for PostgreSQL 9.3 creates tables with double quotes embedded in the name

Поиск
Список
Период
Сортировка
От Rob Richardson
Тема Re: PGAdmin for PostgreSQL 9.3 creates tables with double quotes embedded in the name
Дата
Msg-id 67D108EDFAD3C148A593E6ED7DCB4BBDD8468869@RADCONWIN2K8PDC.radcon.local
обсуждение исходный текст
Ответ на Re: PGAdmin for PostgreSQL 9.3 creates tables with double quotes embedded in the name  (Darren Duncan <darren@darrenduncan.net>)
Ответы Re: PGAdmin for PostgreSQL 9.3 creates tables with double quotes embedded in the name  ("J.F. Oster" <jinfroster@mail.ru>)
Re: PGAdmin for PostgreSQL 9.3 creates tables with double quotes embedded in the name  (Darren Duncan <darren@darrenduncan.net>)
Список pgadmin-support
<div class="WordSection1"><p class="MsoPlainText">Darren,<p class="MsoPlainText"> <p class="MsoPlainText">You are not
listeningto me.<p class="MsoPlainText"> <p class="MsoPlainText">If I was using plain SQL, entered manually, I would use
alllower-case characters.<p class="MsoPlainText"> <p class="MsoPlainText">I am not using plain SQL entered manually.  I
amusing PGAdmin's table creation tool.  That is why this thread was started in the PGAdminSupport group instead of
pg_general. My table creation process starts here:<p class="MsoPlainText"> <p class="MsoPlainText"><img height="510"
id="Picture_x0020_1"src="cid:image001.png@01CF7E3C.BF881DA0" width="741" /><p class="MsoPlainText"> <p
class="MsoPlainText">Ithen specify columns like this:<p class="MsoPlainText"> <p class="MsoPlainText"><img height="510"
id="Picture_x0020_2"src="cid:image002.png@01CF7E3C.E9D32460" width="741" /><p class="MsoPlainText"> <p
class="MsoPlainText">Ithen specify a primary key like this:<p class="MsoPlainText"> <p class="MsoPlainText"><img
height="510"id="Picture_x0020_3" src="cid:image003.png@01CF7E3D.C2421810" width="741" /><p class="MsoPlainText"> <p
class="MsoPlainText">Ithen use PGAdmin’s SQL window to try to access the table:<p class="MsoPlainText"> <p
class="MsoPlainText"><imgheight="547" id="Picture_x0020_4" src="cid:image004.png@01CF7E3D.C2421810" width="1155" /><p
class="MsoPlainText"> <pclass="MsoPlainText">In this case, as I was afraid of, the query worked, telling me there was
nodata in the table.  That is not the result I was seeing last week.<p class="MsoPlainText"> <p
class="MsoPlainText">Pleasedo not insult my intelligence by telling me that I created the table I was asking about in
someway other than the one shown above.  The method shown above is how I created the table.  I repeat:  I did not use a
manuallytyped SQL statement to create the table.<p class="MsoPlainText"> <p class="MsoPlainText">When I first created
thetable, I named it “Log”.  My first guess was that that was a reserved word, and PostgreSQL automatically wrapped it
indouble quotes to make sure that the word would be handled as a name rather than as a keyword.  I believe that that
muchis correct.  But then I changed name to “AnotherLog”, and I still had the same problem.  Then I dropped the table
andrecreated it using a name like “ThisIsALogTableButItsNameIsNotAKeyword”.  I still had the same problem!  Finally, I
hadto drop the table created using PGAdmin and use the SQL query window to manually enter a CREATE TABLE query.<p
class="MsoPlainText"> <pclass="MsoPlainText">I am relieved to see that I could not recreate the problem now, since that
meansthat my company will not have to change its normal practices when creating databases, but I would still like to
understandexactly what happened so that I can avoid it in the future.  And if this is a bug in PGAdmin, perhaps it can
befixed.<p class="MsoPlainText"> <p class="MsoPlainText">Rob Richardson<p class="MsoPlainText">Rad-Con, Incorproated<p
class="MsoPlainText"> <pclass="MsoPlainText">-----Original Message-----<br /> From: Darren Duncan
[mailto:darren@darrenduncan.net]<br /> Sent: Friday, May 30, 2014 5:23 PM<br /> To: Rob Richardson;
pgadmin-support@postgresql.org<br/> Subject: Re: [pgadmin-support] PGAdmin for PostgreSQL 9.3 creates tables with
doublequotes embedded in the name<p class="MsoPlainText"> <p class="MsoPlainText">Rob, this is what you do.<p
class="MsoPlainText"> <pclass="MsoPlainText">Either:<p class="MsoPlainText"> <p class="MsoPlainText">1. Use plain
lowercasefor all of your tablevar and other entity names, meaning it will work both quoted and unquoted in all
contexts.<pclass="MsoPlainText"> <p class="MsoPlainText">2. If you use any uppercase, then if writing SQL you use
double-quotesaround said entity nmes everywhere they appear.<p class="MsoPlainText"> <p class="MsoPlainText">See, SQL
entitiesare case-sensitive in the general case of being quoted, but in the special case of not quoting the names in
SQL,they are folded to lowercase before being matched.<p class="MsoPlainText"> <p class="MsoPlainText">If this is all
complicatedto you, then just use straight lowercase everywhere and it will just work.<p class="MsoPlainText"> <p
class="MsoPlainText">--Darren Duncan<p class="MsoPlainText"> <p class="MsoPlainText">On 2014-05-30, 1:56 PM, Rob
Richardsonwrote:<p class="MsoPlainText">> Thank you for your reply.  You said, in part:<p
class="MsoPlainText">> <pclass="MsoPlainText">>             What's happening in your case is that the table must
havebeen created like this:<p class="MsoPlainText">> <p class="MsoPlainText">>                            
  createtable "Log" [.....]<p class="MsoPlainText">> <p class="MsoPlainText">> But the whole point of my message
isthat that is not how this table was created.  I did not open an SQL window and type in the CREATE TABLE command
manually. I selected the database in PGAdmin, went down to the Tables list (which said I had 0 table), right clicked on
theword "Tables", and selected "New table".  In the new table dialog I entered the table name as Log (no quotes), I
definedits columns and its primary key, and I clicked OK.  After I did all that, I then found that "select * from Log"
(noquotes around Log) failed, claiming there was no relation named "Log".  I then found that "select * from "Log" "
(quotesaround Log) worked.  I then concluded that the table was being created with the double quotes included in the
tablename.<p class="MsoPlainText">> <p class="MsoPlainText">> I did find one place where I actually saw the name
referredto as '"Log"'.  That's the word Log, surrounded by double quotes, and then surrounded again by single quotes. 
Unfortunately,I do not now remember where that was.<p class="MsoPlainText">> <p class="MsoPlainText">> RobR<p
class="MsoPlainText"> <pclass="MsoPlainText"> </div> 

В списке pgadmin-support по дате отправления:

Предыдущее
От: Konstantin Mikhailov
Дата:
Сообщение: Re: pgAdmin 1.18.1 (win7) shows dots
Следующее
От: "J.F. Oster"
Дата:
Сообщение: Re: PGAdmin for PostgreSQL 9.3 creates tables with double quotes embedded in the name