Srinivasa T N <seenutn@xxxxxxxxx> writes: > Hi, > I have a parent table with one of the field as ""gid" int4 DEFAULT > nextval('"ami_smart_new".aoi_boundary_gid_seq'::regclass)". > > I create child tables which inherit parent and use hash partition. When > I directly insert into child tables, will there be any race condition > causing two child tables getting the same sequence value for gid? > Assuming all inserts use the default e.g. nextval from the same sequence, you won't get duplicates. You could get a duplicate if an insert sets an explicit value for gid of course or if rows in any table were inserted with a gid which was not obtained from the same sequence using nextval i.e. parent and children use same sequence. The sequence is just a counter with the property that no two calls to nextval from that sequence will have the same value. You cannot make any additional assumptions e.g. cannot assume gid values will be inserted in order or there won't be 'gaps ' etc. -- Tim Cross