Thread: multiple default values specified for column?

multiple default values specified for column?

From
smorrey@gmail.com
Date:
Hello pgsql is complaining and I can't seem to figure out what the
error is talking about.
Basically it's claiming that multiple default vaues are being
specified, but nowhere in statement below is there one single place
where I can see an error.
Please help!

SQL error:

ERROR:  multiple default values specified for column "txnid" of table
"ec_transaction"

In statement:

CREATE TABLE ec_transaction (
    txnid BIGSERIAL NOT NULL DEFAULT
nextval('public.ec_transaction_txnid_seq') ,
    uid integer DEFAULT 0 NOT NULL,
    mail character varying(64) DEFAULT ''::character varying NOT NULL,
    shipping_firstname character varying(32) DEFAULT ''::character
varying NOT NULL,
    shipping_lastname character varying(32) DEFAULT ''::character
varying NOT NULL,
    shipping_street1 character varying(64) DEFAULT ''::character
varying NOT NULL,
    shipping_street2 character varying(64) DEFAULT ''::character
varying NOT NULL,
    shipping_zip character varying(11) DEFAULT ''::character varying
NOT NULL,
    shipping_city character varying(32) DEFAULT ''::character varying
NOT NULL,
    shipping_state character varying(32) DEFAULT ''::character varying
NOT NULL,
    shipping_cost numeric(11,2) DEFAULT 0.00 NOT NULL,
    shipping_country character varying(2) DEFAULT ''::character varying
NOT NULL,
    billing_firstname character varying(32) DEFAULT ''::character
varying NOT NULL,
    billing_lastname character varying(32) DEFAULT ''::character
varying NOT NULL,
    billing_street1 character varying(64) DEFAULT ''::character varying
NOT NULL,
    billing_street2 character varying(64) DEFAULT ''::character varying
NOT NULL,
    billing_zip character varying(11) DEFAULT ''::character varying NOT
NULL,
    billing_city character varying(32) DEFAULT ''::character varying
NOT NULL,
    billing_state character varying(32) DEFAULT ''::character varying
NOT NULL,
    billing_country character varying(2) DEFAULT ''::character varying
NOT NULL,
    payment_method character varying(32) DEFAULT ''::character varying
NOT NULL,
    payment_status character varying(32) DEFAULT '1'::character varying
NOT NULL,
    coupon integer DEFAULT 0 NOT NULL,
    workflow integer DEFAULT 1 NOT NULL,
    gross numeric(11,2) DEFAULT 0.00 NOT NULL,
    expires integer DEFAULT 0 NOT NULL,
    created integer DEFAULT 0 NOT NULL,
    changed integer DEFAULT 0 NOT NULL,
    CONSTRAINT ec_transaction_coupon_check CHECK ((coupon >= 0)),
    CONSTRAINT ec_transaction_uid_check CHECK ((uid >= 0)),
    CONSTRAINT ec_transaction_workflow_check CHECK ((workflow >= 0))
)


Re: multiple default values specified for column?

From
Tom Lane
Date:
smorrey@gmail.com writes:
> ERROR:  multiple default values specified for column "txnid" of table
> "ec_transaction"

> CREATE TABLE ec_transaction (
>     txnid BIGSERIAL NOT NULL DEFAULT
> nextval('public.ec_transaction_txnid_seq') ,

SERIAL/BIGSERIAL implies a default clause.  If you want to attach the
column to a pre-existing sequence, just declare it int or bigint.

            regards, tom lane

Re: multiple default values specified for column?

From
Stephan Szabo
Date:
On Fri, 7 Oct 2005 smorrey@gmail.com wrote:

> Hello pgsql is complaining and I can't seem to figure out what the
> error is talking about.
> Basically it's claiming that multiple default vaues are being
> specified, but nowhere in statement below is there one single place
> where I can see an error.
> Please help!

Bigserial implies a default and then you placed a default on the column in
addition.

>
> SQL error:
>
> ERROR:  multiple default values specified for column "txnid" of table
> "ec_transaction"
>
> In statement:
>
> CREATE TABLE ec_transaction (
>     txnid BIGSERIAL NOT NULL DEFAULT
> nextval('public.ec_transaction_txnid_seq') ,