错误:创建新表时“(”处或附近的语法错误

时间:2014-02-12 01:31:53

标签: postgresql

我是PostgreSQL的新手,每次尝试创建新表时,都会遇到以下错误:

ERROR:  syntax error at or near "(" LINE 1: ..." ("id_azucarusuario" 
   SERIAL, "id_usuario" integer(128) NOT ...

这是我想要定义的表的SQL:

CREATE TABLE "public"."usuario_azucar" 
( "id_azucarusuario" SERIAL,
  "id_usuario" integer(128) NOT NULL, 
  "codigogeneral" character varying(240) NOT NULL, 
  "razonsocial" character(240), 
  "nombrecomercial" character(240), 
  "nit" integer(128), 
  "nummatricula" integer(128),
  "direccionempresa" character(240), 
  "subdepartamento" character(240),
  "subciudad" character(240), 
  "subdireccion" character varying(240),
  "subcalle" character varying(240), 
  "subreferencia" character varying(240), 
  "subtelefono" integer(128), 
  "subpagweb" character(240),
  "subemail" character varying(240), 
  "rai" character varying(240),
  "descripcion_proceso_azucar" character varying(240),
  "descripcion_proceso_alcohol" character varying(240),
  "balance_energeticoomasic" character varying(240),
  "productos_obtenidos" character varying(240), 
  "capacidad_azuoalco" character varying(240), 
  "capacidadreal_azuoalcoho" character varying(240), 
  PRIMARY KEY ("id_azucarusuario")
) 
WITHOUT OIDS;

2 个答案:

答案 0 :(得分:2)

没有integer(...)类型,请在此处给出范围,选择smallintintegerbiginthttp://www.postgresql.org/docs/current/interactive/datatype-numeric.html

答案 1 :(得分:0)

请勿使用任何保留关键字..

您必须从' 公开'更改表格名称到其他东西..因为它是postgresql上的保留关键字..

DataFrame.to_json