pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #5839: pgAdmin makes bad query for creating a table when default value specified
5+ messages / 4 participants
[nested] [flat]

* BUG #5839: pgAdmin makes bad query for creating a table when default value specified
@ 2011-01-15 03:32  Aren Cambre <aren@arencambre.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Aren Cambre @ 2011-01-15 03:32 UTC (permalink / raw)
  To: pgsql-bugs


The following bug has been logged online:

Bug reference:      5839
Logged by:          Aren Cambre
Email address:      aren@arencambre.com
PostgreSQL version: 9.0.2
Operating system:   Windows 7 32 bit
Description:        pgAdmin makes bad query for creating a table when
default value specified
Details: 

Using pgAdmin 1.12.2, I just tried to create a table with a character
varying(18) column. I put "none" (without the quotes) in the "Default value"
field for that column.

When I press OK to create the table, I get a dialog saying:
  An error has occurred:
  ERROR: column "none" does not exist

This is the SQL that's generated:

CREATE TABLE "raw"."TxDPS geocoding"
(
   "HA_Arrest_Key" character varying(18), 
   gid integer, 
   "whichToUse" character varying(20) NOT NULL DEFAULT none, 
    PRIMARY KEY ("HA_Arrest_Key")
) 
WITH (
  OIDS = FALSE
)
;



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: BUG #5839: pgAdmin makes bad query for creating a table when default value specified
@ 2011-01-15 03:51  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Aren Cambre <aren@arencambre.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Tom Lane @ 2011-01-15 03:51 UTC (permalink / raw)
  To: Aren Cambre <aren@arencambre.com>; +Cc: pgsql-bugs

"Aren Cambre" <aren@arencambre.com> writes:
> Using pgAdmin 1.12.2, I just tried to create a table with a character
> varying(18) column. I put "none" (without the quotes) in the "Default value"
> field for that column.

> When I press OK to create the table, I get a dialog saying:
>   An error has occurred:
>   ERROR: column "none" does not exist

Well, yeah, that's what you'll get.  I don't see a bug here.
If you want the literal string 'none' as default, you should put quotes
around it.  If you don't want a default, you shouldn't put anything
there.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: BUG #5839: pgAdmin makes bad query for creating a table when default value specified
@ 2011-01-15 04:12  Aren Cambre <aren@arencambre.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 5+ messages in thread

From: Aren Cambre @ 2011-01-15 04:12 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-bugs

This came from pgAdmin's *Default value* field. This field is supposed to
accept anything other than a string?

Aren

On Fri, Jan 14, 2011 at 9:51 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

> "Aren Cambre" <aren@arencambre.com> writes:
> > Using pgAdmin 1.12.2, I just tried to create a table with a character
> > varying(18) column. I put "none" (without the quotes) in the "Default
> value"
> > field for that column.
>
> > When I press OK to create the table, I get a dialog saying:
> >   An error has occurred:
> >   ERROR: column "none" does not exist
>
> Well, yeah, that's what you'll get.  I don't see a bug here.
> If you want the literal string 'none' as default, you should put quotes
> around it.  If you don't want a default, you shouldn't put anything
> there.
>
>                        regards, tom lane
>

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: BUG #5839: pgAdmin makes bad query for creating a table when default value specified
@ 2011-01-15 04:36  John R Pierce <pierce@hogranch.com>
  parent: Aren Cambre <aren@arencambre.com>
  0 siblings, 1 reply; 5+ messages in thread

From: John R Pierce @ 2011-01-15 04:36 UTC (permalink / raw)
  To: pgsql-bugs

On 01/14/11 8:12 PM, Aren Cambre wrote:
> This came from pgAdmin's *Default value* field. This field is supposed 
> to accept anything other than a string?

default value can be any valid expression





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: BUG #5839: pgAdmin makes bad query for creating a table when default value specified
@ 2011-01-15 07:57  Dave Page <dpage@pgadmin.org>
  parent: John R Pierce <pierce@hogranch.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Dave Page @ 2011-01-15 07:57 UTC (permalink / raw)
  To: John R Pierce <pierce@hogranch.com>; +Cc: pgsql-bugs

On Sat, Jan 15, 2011 at 4:36 AM, John R Pierce <pierce@hogranch.com> wrote:
> On 01/14/11 8:12 PM, Aren Cambre wrote:
>>
>> This came from pgAdmin's *Default value* field. This field is supposed to
>> accept anything other than a string?
>
> default value can be any valid expression

Exactly. pgAdmin doesn't have any way to know whether what you've
entered is a plain string or an expression of some kind, so it leaves
it to you to provide the quoting in this case.


-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2011-01-15 07:57 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-01-15 03:32 BUG #5839: pgAdmin makes bad query for creating a table when default value specified Aren Cambre <aren@arencambre.com>
2011-01-15 03:51 ` Tom Lane <tgl@sss.pgh.pa.us>
2011-01-15 04:12   ` Aren Cambre <aren@arencambre.com>
2011-01-15 04:36     ` John R Pierce <pierce@hogranch.com>
2011-01-15 07:57       ` Dave Page <dpage@pgadmin.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox