How to configure PostgreSQL to accept all incoming connections

Just use 0.0.0.0/0. host all all 0.0.0.0/0 md5 Make sure the listen_addresses in postgresql.conf (or ALTER SYSTEM SET) allows incoming connections on all available IP interfaces. listen_addresses=”*” After the changes you have to reload the configuration. One way to do this is execute this SELECT as a superuser. SELECT pg_reload_conf(); Note: to change listen_addresses, a … Read more

Generate series of dates – using date type as input

Thanks to function type resolution we can also pass date values to generate_series() because there is an implicit cast from date to timestamp as well as from date to timestamptz. Would be ambiguous, but timestamptz is “preferred” among “Date/time types”. Detailed explanation: Generating time series between two dates in PostgreSQL For a bare date the … Read more

Buffers (Circle) in PostGIS

Isn’t it just doing what is supposed to be done? Which is to compensate the distortion due to projecting the ellipsoid into a 2D flat structure? I believe, the further away you get from the equator, the more oval buffers you will see. Examples: db=# SELECT ST_AsText( ST_Buffer( ST_GeomFromText(‘SRID=4326;POINT(43.29 5.41)’),0.001, ‘quad_segs=16’) ); This query returns … Read more

Postgres password authentication fails

As shown in the latest edit, the password is valid until 1970, which means it’s currently invalid. This explains the error message which is the same as if the password was incorrect. Reset the validity with: ALTER USER postgres VALID UNTIL ‘infinity’; In a recent question, another user had the same problem with user accounts … Read more

PostgreSQL: serial vs identity

serial is the “old” implementation of auto-generated unique values that has been part of Postgres for ages. However that is not part of the SQL standard. To be more compliant with the SQL standard, Postgres 10 introduced the syntax using generated as identity. The underlying implementation is still based on a sequence, the definition now … Read more