From: Tom Lane <tgl@sss.pgh.pa.us>
To: Marco Fochesato <marcofoc@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Not able to update some rows in a table
Date: Mon, 02 Jul 2018 12:06:10 -0400
Message-ID: <63928.1530547570@sss.pgh.pa.us> (raw)
In-Reply-To: <CAECC44d53AtoQNKhzOfd0m+-WR_Gi404W2rFR6TY0kXU9eGiBg@mail.gmail.com>
References: <CAECC44feKzvSFx-EVB3zEFejwDJQPepvwjw1NXAL9X+qZp4HBg@mail.gmail.com>
<f0baca8a-5532-bb95-b509-415656cd6725@portavita.eu>
<CAECC44d53AtoQNKhzOfd0m+-WR_Gi404W2rFR6TY0kXU9eGiBg@mail.gmail.com>
Marco Fochesato <marcofoc@gmail.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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, marcofoc@gmail.com
Subject: Re: Not able to update some rows in a table
In-Reply-To: <63928.1530547570@sss.pgh.pa.us>
References: <CAECC44feKzvSFx-EVB3zEFejwDJQPepvwjw1NXAL9X+qZp4HBg@mail.gmail.com> <f0baca8a-5532-bb95-b509-415656cd6725@portavita.eu> <CAECC44d53AtoQNKhzOfd0m+-WR_Gi404W2rFR6TY0kXU9eGiBg@mail.gmail.com> <63928.1530547570@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox