Page 1 of 1

Constraint blc_state

Posted: Wed Oct 08, 2014 1:37 pm
by tiagovt
I suggest add constraint fields : abbreviation name and country , because in other country same abbreviation for state.

Thanks.

Re: Constraint blc_state

Posted: Wed Oct 08, 2014 3:44 pm
by phillipuniverse
You should instead use the ISO 3166-2 code which accounts for the country code in combination with the region code: http://en.wikipedia.org/wiki/ISO_3166-2

Re: Constraint blc_state

Posted: Wed Oct 08, 2014 3:45 pm
by phillipuniverse
By the way we are deprecating this table in favor of something called CountrySubdivision (BLC_COUNTRY_SUB) as it represents something more generic than a "state" (which is really a term that is specific to the US).

Re: Constraint blc_state

Posted: Thu Oct 09, 2014 8:03 am
by tiagovt
Example :

This constraint generate in the table :

Code: Select all

ALTER TABLE blc_state
  ADD CONSTRAINT blc_state_pkey PRIMARY KEY(abbreviation);


this result the Alabama register : "AL";"ALABAMA";"US".

A need insert Alagoas state of Brazil the abbreviation is same of Alabama :

Code: Select all

insert into blc_state(abbreviation, name, country) values ('AL', 'ALAGOAS', 'BR')


error :

Code: Select all

SQL state: 23505
Detail: key(abbreviation)=(AL) for exist.

Re: Constraint blc_state

Posted: Fri Oct 10, 2014 1:34 am
by phillipuniverse
As I said, use the ISO-3166-2 code for the states. Fromvthe Wikipedia link that I posted, the ISO-3166-2 code for Alabama is 'US-AL'. This is what you need to put as the abbreviation in the BLC_STATE table. Alagoas is BR-AL according to ISO-3166-2.

Re: Constraint blc_state

Posted: Wed Jan 28, 2015 5:45 am
by Chancepe
For the management of customer address, we can only select state, but not city. In my opinion, we would like to select city we need rather than input it manually. So it will be more convenience for users if you make this change.
Thanks!