question re double quotes

Поиск
Список
Период
Сортировка
Искать

question re double quotes

От:
Ben Kim <bkim@edsun.coe.tamu.edu>
Дата:
Hi,

I wonder if it is possible to let psql recognize Mixed-case-named
("LikeThisName") table names without double quotes in sql statements.

Thanks to the readline, the table name seems to autoexpand to the full
name "LikeThisName", if I just type in "Like" and press the tab key. But
when I execute the sql statement, it gives me 

	ERROR:  Relation "likethisname" does not exist.

Obviously psql uniquely recognizes the name without double quotes (being
able to autoexpand) but won't accept its own creation as valid...

The bash shell in cygwin recognizes both cases and presents choices, if I 
put this line in .inputrc.
  # Ignore case while completing
  set completion-ignore-case on

Is there such a feature already? Or, could I submit it as a suggestion? We
have many table and field names with double quotes, so it will save us a
lot of keystrokes. (Also perhaps some errors related with using Access as
frontend...) 

Even if we use mixed-case names, it's primarily for descriptive names, and
we don't use same-letters-different-case names.


Regards,
Ben

Re: question re double quotes

От:
Bruno Wolff III <bruno@wolff.to>
Дата:
On Wed, Oct 15, 2003 at 16:45:39 -0500,
  Ben Kim  wrote:
> 
> I wonder if it is possible to let psql recognize Mixed-case-named
> ("LikeThisName") table names without double quotes in sql statements.

You probably don't want to create tables with mixed case names in the
first place.

Re: question re double quotes

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Bruno Wolff III  writes:
> On Wed, Oct 15, 2003 at 16:45:39 -0500,
>   Ben Kim  wrote:
>> I wonder if it is possible to let psql recognize Mixed-case-named
>> ("LikeThisName") table names without double quotes in sql statements.

> You probably don't want to create tables with mixed case names in the
> first place.

The real problem is that the tab-completion code doesn't work properly
with quoted names.  For example, if I do

	create table "MixedCase" (f1 int);

then

	update M

completes as

	update MixedCase

which is wrong (no double quotes).  Arguably it's my fault for not
supplying the initial quote, but

	update "M

fails to offer any completions at all.  Somebody should work on this
sometime.

Actually, maybe all we need to do is apply quote_ident() in the
tab-completion queries ... hmmm ...

			regards, tom lane

Re: question re double quotes

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Ben Kim  writes:
> Thanks for the reply.  I haven't looked at the source code yet, but
> assuming I understood it correctly, if we can simply add double quotes
> around tab-completed names, it alone would be very convenient. 

> On Thu, 16 Oct 2003, Tom Lane wrote:
>> Actually, maybe all we need to do is apply quote_ident() in the
>> tab-completion queries ... hmmm ...

I did commit a fix along this line last week.  As of CVS tip,
given
	create table "MixedCase" (f1 int);
psql will offer no completions for
	update M
but will auto-complete
	update "M
as
	 update "MixedCase"

			regards, tom lane

Re: question re double quotes

От:
Ben Kim <bkim@edsun.coe.tamu.edu>
Дата:
Thanks.

Regards,
Ben

On Mon, 20 Oct 2003, Tom Lane wrote:

> Ben Kim  writes:
> > Thanks for the reply.  I haven't looked at the source code yet, but
> > assuming I understood it correctly, if we can simply add double quotes
> > around tab-completed names, it alone would be very convenient. 
> 
> > On Thu, 16 Oct 2003, Tom Lane wrote:
> >> Actually, maybe all we need to do is apply quote_ident() in the
> >> tab-completion queries ... hmmm ...
> 
> I did commit a fix along this line last week.  As of CVS tip,
> given
> 	create table "MixedCase" (f1 int);
> psql will offer no completions for
> 	update M
> but will auto-complete
> 	update "M
> as
> 	 update "MixedCase"
> 
> 			regards, tom lane
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
>       subscribe-nomail command to majordomo@postgresql.org so that your
>       message can get through to the mailing list cleanly
> 

Re: question re double quotes

От:
Ben Kim <bkim@edsun.coe.tamu.edu>
Дата:

Thanks for the reply.  I haven't looked at the source code yet, but
assuming I understood it correctly, if we can simply add double quotes
around tab-completed names, it alone would be very convenient. 


Regards,
Ben

On Thu, 16 Oct 2003, Tom Lane wrote:

> Bruno Wolff III  writes:
> > On Wed, Oct 15, 2003 at 16:45:39 -0500,
> >   Ben Kim  wrote:
> >> I wonder if it is possible to let psql recognize Mixed-case-named
> >> ("LikeThisName") table names without double quotes in sql statements.
> 
> > You probably don't want to create tables with mixed case names in the
> > first place.
> 
> The real problem is that the tab-completion code doesn't work properly
> with quoted names.  For example, if I do
> 
> 	create table "MixedCase" (f1 int);
> 
> then
> 
> 	update M
> 
> completes as
> 
> 	update MixedCase
> 
> which is wrong (no double quotes).  Arguably it's my fault for not
> supplying the initial quote, but
> 
> 	update "M
> 
> fails to offer any completions at all.  Somebody should work on this
> sometime.
> 
> Actually, maybe all we need to do is apply quote_ident() in the
> tab-completion queries ... hmmm ...
> 
> 			regards, tom lane
> 

FAQ