Re: strangeness
| From: | fabrizio dot ermini at sysdat dot it | Date: | Wed, 04 Oct 2000 09:20:13 +0000 |
| Subject: | Re: strangeness | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-3285@lists.php.net to get a copy of this message | ||
> CREATE TABLE ISshipping (
> ship_method_id int(11) DEFAULT NOT NULL NEXTVAL('ship_method_id'),
> ship_carrier_id varchar(12),
> ship_carrier_code varchar(11),
> ship_carrier_name varchar(32),
> ship_method_code varchar(11) DEFAULT NOT NULL,
> ship_method_name varchar(32),
> ship_publish char(1),
> ship_handling_charge decimal(4,2),
> ship_handling_type char(1),
> ship_lead_time int(3),
> ship_heavy char(1),
> ship_msg_header text,
> ship_msg_footer text,
> cdate int(11),
> mdate int(11),
> vendor_id int(11) DEFAULT NOT NULL,
> PRIMARY KEY (ship_method_id)
> );
>
There are two errors: first the order for "default" and "not null" is
wrong, i.e. the correct one is
DEFAULT NEXTVAL('sequence') NOT NULL
(however, if you put in a default the NOT NULL is pleonastic ;-))
Second, the notation int(x) doesn't have sense in postgres. You
can use int2, int4 or (if available on your system) int8 (where the
number is the lenght in bytes) or numeric(X), where X is the length
in digits.
I suggest you use the first notation, that is the native type for
integer data. In fact, 6.5.3 can't build indexes on NUMERIC type
columns.
HTH!
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Fabrizio Ermini Alternate E-mail:
C.so Umberto, 7 faermini@tin.it
loc. Meleto Valdarno Mail on GSM: (keep it short!)
52020 Cavriglia (AR) faermini@sms.tin.it