Re: Enforcing uniqueness on [real estate/postal] addresses

2020-05-12 Thread Peter Devoy
>Is is possible to have two entries which have the same >address_identifier_general, street and postcode, but different >descriptions? Unfortunately, yes. The data comes from gov't systems to regulate the development/alteration of arbitrary pieces of property and those pieces do not always have a

Re: Enforcing uniqueness on [real estate/postal] addresses

2020-05-11 Thread Peter Devoy
Hello everyone Thank you all for your suggestions. I had neither heard of partial unique indexes nor considered using COALESCE so I will explore both of these as options and update the thread with how it goes. >Then, if you can define a problem where you feel having a unique table >constraint o

Enforcing uniqueness on [real estate/postal] addresses

2020-05-11 Thread Peter Devoy
Hi list I need to store addresses for properties (as in real estate) so in my naivety I created a unique constraint like this: ALTER TABLE properties ADD CONSTRAINT is_unique_address UNIQUE ( description, --e.g. Land north of Foo Cottage address_identifier_general,

Re: Primary key data type: integer vs identity

2019-04-23 Thread Peter Devoy
Hi Rich I think you may have serial already there (indicated by sequence in the the default value). If you wish to change to identity columns this should be useful: https://www.2ndquadrant.com/en/blog/postgresql-10-identity-columns/ Regards Peter

Re: User-defined print format for extension-defined types in psql output

2017-12-16 Thread Peter Devoy
Thanks Laurenz.

User-defined print format for extension-defined types in psql output

2017-12-14 Thread Peter Devoy
Hi list To make inspecting PostGIS tables in psql easier I have written a function which outputs PostGIS Geometry objects as a string of ASCII art. Please does anyone know if there is there some way I can have my function called automatically by psql instead of me writing it into the query each t