pgadmin4 SQL创建表查询在Ubuntu 18.04上的Postgresql命令行中不起作用

时间:2018-10-25 10:07:27

标签: postgresql ubuntu pgadmin

我在Windows上使用pgadmin4创建了一个表。然后,我从pgadmin4 SQL窗口复制了创建表查询,并粘贴在ubuntu 18.04上的psql命令行中。

出现以下错误:

ERROR:  relation "weather_measurements_meas_id_seq" does not exist

这是我从pgadmin4复制的创建表查询:

CREATE TABLE public.weather_measurements
(
    meas_id bigint NOT NULL DEFAULT nextval('weather_measurements_meas_id_seq'::regclass),
    meas_dev_id integer NOT NULL,
    "dateTime" timestamp without time zone,
    w_speed real,
    w_gust real,
    w_direction real,
    w_unit character varying COLLATE pg_catalog."default",
    humidity real,
    pressure integer,
    light integer,
    rain integer,
    "2nd_temp" real,
    lws real,
    lws_cnt real,
    solar integer,
    temperature real,
    CONSTRAINT weather_measurements_pkey PRIMARY KEY (meas_id),
    CONSTRAINT meas_dev_id FOREIGN KEY (meas_dev_id)
        REFERENCES public.measuring_devices (meas_dev_id) MATCH SIMPLE
        ON UPDATE NO ACTION
        ON DELETE NO ACTION
)
WITH (
    OIDS = FALSE
)
TABLESPACE pg_default;

ALTER TABLE public.weather_measurements
    OWNER to postgres;

如何更正它。

0 个答案:

没有答案