• [^] # Re: Quelques pistes?

    Posté par . En réponse au message Problème exécution script SQL. Évalué à 2.

    Merci de ta réponse,

    pour faire suivre la discution, je vais préciser par rapport aux points que tu soulèves :

    - psql -U postgres -d mabase -f monscript.sql ne change pas le comportement

    - psql -U postgres -d mabase < monscript.sql ne change pas le comportement

    - Je suis reparti d'un pg_dump et je n'ai pas mieux,

    mon script SQL :


    --
    -- PostgreSQL database dump
    --

    SET client_encoding = 'UTF8';
    SET standard_conforming_strings = off;
    SET check_function_bodies = false;
    SET client_min_messages = warning;
    SET escape_string_warning = off;
    SET search_path = public, pg_catalog;
    SET default_tablespace = '';
    SET default_with_oids = false;
    SET datestyle TO European;

    --
    -- Name: ra_credit_impute_def; Type: TABLE; Schema: public; Owner: proto; Tablespace:
    --

    DROP TABLE IF EXISTS ra_credit_impute_def;
    CREATE TABLE ra_credit_impute_def (
    ligne_affectee character varying(40) NOT NULL,
    ligne_obf character varying(5),
    on_recette_accidentelle character(1) NOT NULL,
    on_imputation_excedentaire character(1) NOT NULL,
    version numeric(3,0),
    id_reference character varying(14) NOT NULL,
    ra_cred_imp_pro_no_cred_imp character varying(255),
    no_credit_impute character varying(255) NOT NULL
    );

    ALTER TABLE public.ra_credit_impute_def OWNER TO proto;

    --
    -- Data for Name: ra_credit_impute_def; Type: TABLE DATA; Schema: public; Owner: proto
    --

    COPY ra_credit_impute_def from '/home/damien/proto/ra_credit_impute_def.dat'
    WITH CSV;
    --
    -- Name: ra_credit_impute_def_pk; Type: CONSTRAINT; Schema: public; Owner: proto; Tablespace:
    --

    ALTER TABLE ONLY ra_credit_impute_def
    ADD CONSTRAINT ra_credit_impute_def_pk PRIMARY KEY (no_credit_impute);

    --
    -- Name: ra_credit_impute_def_fk01; Type: INDEX; Schema: public; Owner: proto; Tablespace:
    --

    CREATE INDEX ra_credit_impute_def_fk01 ON ra_credit_impute_def USING btree (id_reference);

    ALTER TABLE ra_credit_impute_def CLUSTER ON ra_credit_impute_def_fk01;


    et le résultat :


    $ psql -U postgres -d proto -f ra_credit_impute_def.sql
    psql:ra_credit_impute_def.sql:5: ERROR: syntax error at or near ""
    LINE 1:
    ^
    SET
    SET
    SET
    SET
    SET
    SET
    SET
    SET
    DROP TABLE
    CREATE TABLE
    ALTER TABLE
    COPY 1000
    ALTER TABLE
    CREATE INDEX
    ALTER TABLE