Link to home
Start Free TrialLog in
Avatar of codefaze
codefaze

asked on

Create Table generating relation session_id_seq does not exist

I'm trying to export my tables from pg database and having some probs.  I'm using PG 8 on Windows machine and using Navicat or PG AdminIII. I dump the sql file and get no errors.  However, when I take it to another machine and try to run the querry to re-create my tables I get this error:     Error: relation "comm_session_id_seq" does not exist

The table in question has an auto increment field.  We are more familiar with mysql.  We tried to create an "auto increment" in postgres and believe this is the way they do it in this DB.  Can you tell me what is causing this error?  Is there an easier way to export tables from one DB to another?    Here is the querry.

-- ----------------------------
-- Table structure for public.account_types
-- ----------------------------
CREATE TABLE public.account_types(
id varchar(50) NOT NULL ,
name varchar(50) ,
discription varchar(50) ,
PRIMARY KEY (id)) WITHOUT OIDS;

-- ----------------------------
-- Table structure for public.billing_additional_fees
-- ----------------------------
CREATE TABLE public.billing_additional_fees(
id int4 NOT NULL ,
fee_name varchar(50) ,
fee_description text ,
fee_amount float4 ,
PRIMARY KEY (id)) WITHOUT OIDS;

-- ----------------------------
-- Table structure for public.comm_session
-- ----------------------------
CREATE TABLE public.comm_session(
id varchar(50) NOT NULL DEFAULT nextval('comm_session_id_seq'::regclass),
user_id varchar(50) DEFAULT 0,
ipaddress varchar(50) ,
start_time int4 ,
last_time int4 ,
loggedout bool DEFAULT false,
PRIMARY KEY (id)) WITHOUT OIDS;

-- ----------------------------
-- Table structure for public.countries
-- ----------------------------
CREATE TABLE public.countries(
id varchar(11) NOT NULL ,
countrynamelong varchar(100) ,
countrynameabbr varchar(50) ,
PRIMARY KEY (id)) WITHOUT OIDS;
Avatar of gheist
gheist
Flag of Belgium image

You have to add your custom type to new database before creating tables that use it.
ASKER CERTIFIED SOLUTION
Avatar of earth man2
earth man2
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of codefaze
codefaze

ASKER

Did not know about bigserial.  That looks like it works.  Thx.