Olá pessoal...

Estou tentando importar arquivo CSV e não estou conseguindo....

Como posso resolver meu problema?

Obrigado!


*Arquivo CSV:*

Interpreting Normal/AH,"DO NOT CHANGE [OTH-INTERPSERV (2-5)
non-SLIAN,41,Alisha Davidson]",46.5,95,32152

Interpreting Normal/AH,"DO NOT CHANGE [OTH-INTERPSERV (5+) SLIANZ,92,Angela
Murray]",59,95,32152

Interpreting Normal/AH,"DO NOT CHANGE [OTH-INTERPSERV (5+)
non-SLIANZ,60,Anthony Swindale]",56.5,95,32152


*Comando PSQL usado:*


   - \COPY dm.billables (code, info, unit_cost, unit_price, account_id)
   FROM '/var/lib/pgsql/sql/charge_import.csv' WITH DELIMITER ',' CSV QUOTE
   '"';

*ERRO PSQL:*


   - ERROR:  invalid input syntax for type numeric: "unit_cost"


Tentei também pelo pgadmin, mas retorna o erro:

ERROR: Cannot execute COPY FROM in a read-only transaction


*Tabela dm.billables:*

    CREATE TABLE dm.billables
    (
      billable_id bigint NOT NULL DEFAULT
"nextval"('"dm"."billables_billable_id_seq"'::"regclass"),
      acco

unt_id bigint NOT NULL,
  code character varying(64) NOT NULL,
  info "text",
  m_unit "measurement_unit",
  m_unit_custom character varying(64),
  unit_cost numeric(16,4),
  tax_aggregate_id_cost bigint,
  unit_price numeric(16,4),
  tax_enabled_price boolean DEFAULT true,
  tax_aggregate_id_price bigint,
  ts_created timestamp with time zone NOT NULL DEFAULT
"transaction_timestamp"(),
  ts_modified timestamp with time zone NOT NULL DEFAULT
"transaction_timestamp"(),
  ts_last_used timestamp with time zone,
  is_demo boolean NOT NULL DEFAULT false,
  CONSTRAINT pk_billables PRIMARY KEY ("billable_id"),
  CONSTRAINT fk_cost_task_aggregate_must_exist FOREIGN KEY
(tax_aggregate_id_cost)
      REFERENCES dm.tax_aggregates (tax_aggregate_id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT fk_price_task_aggregate_must_exist FOREIGN KEY
(tax_aggregate_id_price)
      REFERENCES dm.tax_aggregates (tax_aggregate_id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT uc_billable_code_unique_per_account UNIQUE ("account_id", "code"),
  CONSTRAINT cc_m_unit_either_ref_or_custom CHECK (ARRAY["m_unit" IS
NOT NULL, "m_unit_custom" IS NOT NULL] <> ARRAY[true, true]))
_______________________________________________
pgbr-geral mailing list
[email protected]
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral

Responder a