Thread: what is the difference between default 0 vs default '0'

what is the difference between default 0 vs default '0'

From
"Beth Gatewood"
Date:
all-
Could somebody tell me why I would use default 0 vs default '0' in the
following....
CREATE TABLE foo (col1 INTEGER default 0) <-- or default '0'

Thanks-
Beth





Re: what is the difference between default 0 vs default '0'

From
"Christopher Kings-Lynne"
Date:
Hi Beth,

I wouldn't have thought there'd be any difference to you, the user.

If you used 0, then that is an integer and that will be the default.  If you
used '0' then that is a character or string and it will automatically be
cast into an integer when used as a default.

Chris

----- Original Message -----
From: "Beth Gatewood" <beth@vizxlabs.com>
To: <pgsql-sql@postgresql.org>
Sent: Wednesday, June 26, 2002 8:52 AM
Subject: [SQL] what is the difference between default 0 vs default '0'


> all-
> Could somebody tell me why I would use default 0 vs default '0' in the
> following....
> CREATE TABLE foo (col1 INTEGER default 0) <-- or default '0'
>
> Thanks-
> Beth
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>
>





Re: what is the difference between default 0 vs default '0'

From
Lee Harr
Date:
In article <000c01c21cab$c2f35ef0$6901a8c0@bethvizx>, "Beth Gatewood" wrote:
> all-
> Could somebody tell me why I would use default 0 vs default '0' in the
> following....
> CREATE TABLE foo (col1 INTEGER default 0) <-- or default '0'
> 

0 is an integer
'0' is a string

default '0' might work (through type coercion)
but I think default 0 is more clear.