PostgreSQL – How to Use Floating-Point Storage for Time Data Type

datetimepostgresql

At Postgres documentation page Date/Time Types, it says:

For the time types, the allowed range of p is from 0 to 6 when
eight-byte integer storage is used, or from 0 to 10 when
floating-point storage is used.

I tried to produce SQL statement with time(p), when p=10? I always get

WARNING: TIME(10) precision reduced to maximum allowed, 6

No matter if I put seconds in float or not. I realize I'm missing something very obvious. Please give an example when p=10.

Best Answer

From the linked page you provide:

Note: When timestamp values are stored as eight-byte integers (currently the default), microsecond precision is available over the full range of values. When timestamp values are stored as double precision floating-point numbers instead (a deprecated compile-time option), the effective limit of precision might be less than 6. ...

What this says is that in order for timestamp values to be stored as double precision floating-point (and to allow precision up to 10), you need to compile Postgres yourself with that option.

It also says that the precision is then not exactly 10 but it varies depending on the value and may even be less than 6 for some (very high or very low) values.