Re: Not able to update some rows in a table

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Marco Fochesato <marcofoc(at)gmail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Not able to update some rows in a table
Date: 2018-07-02 16:06:10
Message-ID: 63928.1530547570@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Marco Fochesato <marcofoc(at)gmail(dot)com> writes:
> CREATE TABLE public.forniture_ee
> (
> id_cliente integer NOT NULL,
> pod character varying(14) NOT NULL,
> id_fornitore integer NOT NULL,
> mese integer NOT NULL,
> anno integer NOT NULL,
> imponibile_fornitura double precision NOT NULL,
> lettura character varying NOT NULL,
> f1 double precision NOT NULL,
> f2 double precision NOT NULL,
> f3 double precision NOT NULL,
> picco double precision NOT NULL,
> fuori_picco double precision NOT NULL,
> mono double precision NOT NULL,
> perdite_di_rete double precision NOT NULL,
> potenza_max double precision NOT NULL,
> potenza_disponibile double precision NOT NULL,
> costo_potenza_max double precision NOT NULL,
> energia_reattiva double precision NOT NULL,
> imponibile_energia double precision NOT NULL,
> report_inviato boolean,
> energia_e_perdite double precision NOT NULL,
> CONSTRAINT forniture_ee_pkey PRIMARY KEY (id_cliente, pod, id_fornitore,
> mese, anno, imponibile_fornitura, lettura, f1, f2, f3, picco, fuori_picco,
> mono, perdite_di_rete, potenza_max, potenza_disponibile, costo_potenza_max,
> energia_reattiva, imponibile_energia, energia_e_perdite),

That seems like a remarkably strange definition of a primary key.
Are all of those columns really identification of an object, and
not properties of the object?

In any case, I'll bet a lot of money that your can't-update problem
is related to the fuzzy behavior of floating-point columns. Just
because a float8 value prints out as "1.2345" doesn't mean that it'll
be considered equal to a value you write as "1.2345". If this fact
astonishes you, you should likely switch to type numeric.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Charles Clavadetscher 2018-07-02 16:09:41 Re: Not able to update some rows in a table
Previous Message Charles Clavadetscher 2018-07-02 16:04:37 Re: Not able to update some rows in a table