From: Chapman Flack <chap@anastigmatix.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: Re: [PATCH] quiet conversion warning in DatumGetFloat4
Date: Wed, 31 May 2017 01:55:11 -0400
Message-ID: <592E5ABF.8070706@anastigmatix.net> (raw)
In-Reply-To: <5894.1496208390@sss.pgh.pa.us>
References: <592E4D04.1070609@anastigmatix.net>
<5894.1496208390@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
On 05/31/17 01:26, Tom Lane wrote:
> Hm. I think it would be better to use DatumGetInt32 here. Arguably,
> direct use of GET_4_BYTES and its siblings should only appear in
> DatumGetFoo macros.
Like so? These are the 4 sites where {GET,SET}_n_BYTES got introduced
in 14cca1b (for consistency, though only the GET_4 case produces warnings).
-Chap
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackersAttachments:
[text/x-patch] quiet-conversion-warning-getfloat4-v2.patch (819B, ../592E5ABF.8070706@anastigmatix.net/2-quiet-conversion-warning-getfloat4-v2.patch)
download | inline diff:--- src/include/postgres.h 2017-05-31 01:36:16.621829183 -0400+++ src/include/postgres.h 2017-05-31 01:45:51.303427115 -0400@@ -679,7 +679,7 @@
float4 retval;
} myunion;
- myunion.value = GET_4_BYTES(X);+ myunion.value = DatumGetInt32(X);
return myunion.retval;
}
#else
@@ -704,7 +704,7 @@
} myunion;
myunion.value = X;
- return SET_4_BYTES(myunion.retval);+ return Int32GetDatum(myunion.retval);
}
#else
extern Datum Float4GetDatum(float4 X);
@@ -727,7 +727,7 @@
float8 retval;
} myunion;
- myunion.value = GET_8_BYTES(X);+ myunion.value = DatumGetInt64(X);
return myunion.retval;
}
#else
@@ -753,7 +753,7 @@
} myunion;
myunion.value = X;
- return SET_8_BYTES(myunion.retval);+ return Int64GetDatum(myunion.retval);
}
#else
extern Datum Float8GetDatum(float8 X);
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 using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: chap@anastigmatix.net, tgl@sss.pgh.pa.us
Subject: Re: [PATCH] quiet conversion warning in DatumGetFloat4
In-Reply-To: <592E5ABF.8070706@anastigmatix.net>
* 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