Re: Insert in table with UNIQUE index - Mailing list pgsql-admin

From Samed YILDIRIM
Subject Re: Insert in table with UNIQUE index
Date
Msg-id 37051453906853@web20o.yandex.ru
Whole thread Raw
In response to Re: Insert in table with UNIQUE index  (Albe Laurenz <laurenz.albe@wien.gv.at>)
Responses Re: Insert in table with UNIQUE index
List pgsql-admin
<div>Hi Artem,</div><div> </div><div>You can see exact same record in your select results from _infogcngr6716_test
tabledespite uniq index exists, if you create a table inherited from the table.</div><div> </div><div>For
example:</div><div>Createinherited table</div><div><span style="font-family:terminal,monaco;font-size:x-small;">CREATE
TABLEpublic._inforgcngr6716_test_child</span><br /><span
style="font-family:terminal,monaco;font-size:x-small;">(</span><br/><span
style="font-family:terminal,monaco;font-size:x-small;">  LIKE public._inforgchngr6716_test INCLUDING DEFAULTS INCLUDING
CONSTRAINTSINCLUDING INDEXES</span><br /><span style="font-family:terminal,monaco;font-size:x-small;">) </span><br
/><spanstyle="font-family:terminal,monaco;font-size:x-small;">INHERITS (_inforgchngr6716_test)</span><br /><span
style="font-family:terminal,monaco;font-size:x-small;">WITH(</span><br /><span
style="font-family:terminal,monaco;font-size:x-small;"> OIDS = FALSE</span><br /><span
style="font-family:terminal,monaco;font-size:x-small;">);</span></div><div> </div><div>Insertsame records into these
twotable. (No error returns)</div><div><span style="font-family:terminal,monaco;font-size:x-small;">INSERT INTO
_infogcngr6716_test_child(</span><br/><span style="font-family:terminal,monaco;font-size:x-small;">           
_nodetref,_noderref, _messageno)</span><br /><span style="font-family:terminal,monaco;font-size:x-small;">    VALUES
('asd','asd',10);</span><br /><br /><span style="font-family:terminal,monaco;font-size:x-small;">INSERT INTO
_infogcngr6716_test(</span><br/><span style="font-family:terminal,monaco;font-size:x-small;">            _nodetref,
_noderref,_messageno)</span><br /><span style="font-family:terminal,monaco;font-size:x-small;">    VALUES ('asd',
'asd',10);</span></div><div> </div><div>Make select query to parent table</div><div><span
style="font-family:terminal,monaco;font-size:x-small;">SELECT_nodetref, _noderref, _messageno</span><br /><span
style="font-family:terminal,monaco;font-size:x-small;"> FROM _inforgchngr6716_test;</span><br /><br
/></div><div>"asd";"asd";10<br/>"asd";"asd";10<br /><br /></div><div><div>Make select query to only parent
table</div><spanstyle="font-family:terminal,monaco;font-size:x-small;">SELECT _nodetref, _noderref,
_messageno</span><br/><span style="font-family:terminal,monaco;font-size:x-small;">  FROM ONLY
_inforgchngr6716_test;</span></div><div> </div><div>"asd";"asd";10</div><div> </div><div>İyiçalışmalar.</div><div>Samed
YILDIRIM</div><div> </div><div> </div><div> </div><div>27.01.2016,16:14, "Albe Laurenz"
<laurenz.albe@wien.gv.at>:</div><blockquotetype="cite"><p>Artem Tomyuk wrote:<blockquote> I have a table with
uniqueindex with 2 exactly the same rows.<br /> How it can be possible?<br /><br /><br /> CREATE TABLE
_inforgchngr6716_test<br/> (<br />   _nodetref bytea NOT NULL,<br />   _noderref bytea NOT NULL,<br />   _messageno
numeric(10,0)<br/> )<br /> WITH (<br />   OIDS=FALSE<br /> );<br /> ALTER TABLE _inforgchngr6716_test<br />   OWNER TO
postgres;<br/><br /> -- Index: _inforg6716_bynodemsg_rn_test<br /><br /> -- DROP INDEX
_inforg6716_bynodemsg_rn_test;<br/><br /> CREATE UNIQUE INDEX _inforg6716_bynodemsg_rn_test<br />   ON
_inforgchngr6716_test<br/>   USING btree<br />   (_nodetref, _noderref, _messageno);</blockquote><p><br />Maybe index
corruption.<br/>Did you have any crashes?<br /><br />Do you get an error when you<br />   REINDEX INDEX
_inforg6716_bynodemsg_rn_test;<br/><br />Yours,<br />Laurenz Albe<br /><br /><span>-- <br />Sent via pgsql-admin
mailinglist (<a href="mailto:pgsql-admin@postgresql.org">pgsql-admin@postgresql.org</a>)<br />To make changes to your
subscription:<br/><a
href="http://www.postgresql.org/mailpref/pgsql-admin">http://www.postgresql.org/mailpref/pgsql-admin</a><br
/></span></blockquote>

pgsql-admin by date:

Previous
From: Thorsten Schöning
Date:
Subject: Re: Per thread Connection memory
Next
From: John Scalia
Date:
Subject: 9.5 repo question