semi-variable length type

From: James Harper <james(dot)harper(at)bendigoit(dot)com(dot)au>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: semi-variable length type
Date: 2014-02-21 05:14:40
Message-ID: 6035A0D088A63A46850C3988ED045A4B6F3AE0D1@BITCOM1.int.sbss.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I want to make a float(n) type that emulates the mssql float type. The storage requirements are documented as 4 bytes for 1 <= n <=24, and 8 bytes for 25 <= n <= 53. If I understand correctly, my options for emulating this in postgres are:

1. declare as variable length. Storage is then 8 bytes (4 byte length + 4 byte storage), or 12 bytes (4 byte length + 8 byte storage).

2. declare as fixed 8 byte length.

In the absence of some magical 3rd option, I assume #2 is the best way forward... can anyone confirm?

Thanks

James

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2014-02-21 06:09:51 Re: semi-variable length type
Previous Message mark_2014 2014-02-21 02:43:52 table "db1.public.a" and all behind "db1.public.a" tables did not do analyzing