Reference by in \d out - Mailing list pgsql-hackers
From | kenneth d'souza |
---|---|
Subject | Reference by in \d |
Date | |
Msg-id | BAY116-W34D55B3AAAEFF8B8603C61ED190@phx.gbl Whole thread Raw |
Responses |
Re: Reference by in \d |
List | pgsql-hackers |
Hi, <br /><p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font color="#000000" face="Courier New"> </font><p class="MsoPlainText"style="MARGIN: 0in 0in 0pt"><font color="#000000" face="Courier New"> </font><p class="MsoPlainText"style="MARGIN: 0in 0in 0pt"><font color="#000000" face="Courier New">Refering to this request http://momjian.us/mhonarc/patches_hold/msg00022.html</font><pclass="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font color="#000000"face="Courier New">I have created a patch. The output doesn't exaclty match with what is stated here </font><pclass="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font color="#000000" face="Courier New">http://momjian.us/mhonarc/patches_hold/msg00023.html.</font><p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><fontcolor="#000000" face="Courier New"> </font><p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font color="#000000"face="Courier New">However, it does tell the required details in a similar format. I had posted this on -patchesbut somehow it is not appearing as a thread and hence I have posted this on hackers.</font><p class="MsoPlainText"style="MARGIN: 0in 0in 0pt"><font color="#000000" face="Courier New"> </font><p class="MsoPlainText"style="MARGIN: 0in 0in 0pt"><font color="#000000" face="Courier New">Comments?</font><p class="MsoPlainText"style="MARGIN: 0in 0in 0pt"><font color="#000000" face="Courier New"> </font><p class="MsoPlainText"style="MARGIN: 0in 0in 0pt"><font color="#000000" face="Courier New"> </font><p class="MsoPlainText"style="MARGIN: 0in 0in 0pt"><font color="#000000" face="Courier New">osdb_pgarch=# \d htest</font><pclass="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font color="#000000"><font face="Courier New"><span style="mso-spacerun:yes"> </span>Table "public.htest"</font></font><p class="MsoPlainText" style="MARGIN: 0in 0in0pt"><font color="#000000"><font face="Courier New"><span style="mso-spacerun: yes"> </span>Column<span style="mso-spacerun:yes"> </span>|<span style="mso-spacerun: yes"> </span>Type<span style="mso-spacerun: yes"> </span>| Modifiers</font></font><p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font color="#000000" face="CourierNew">--------------+---------------+-----------</font><p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><fontcolor="#000000"><font face="Courier New"><span style="mso-spacerun: yes"> </span>new_id<span style="mso-spacerun:yes"> </span>| integer<span style="mso-spacerun: yes"> </span>| not null</font></font><pclass="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font color="#000000"><font face="Courier New"><spanstyle="mso-spacerun: yes"> </span>test_name<span style="mso-spacerun: yes"> </span>| character(20) |</font></font><pclass="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font color="#000000"><font face="Courier New"><span style="mso-spacerun:yes"> </span>test_cust_id | integer<span style="mso-spacerun: yes"> </span>|</font></font><p class="MsoPlainText"style="MARGIN: 0in 0in 0pt"><font color="#000000" face="Courier New">Indexes:</font><p class="MsoPlainText"style="MARGIN: 0in 0in 0pt"><font color="#000000"><font face="Courier New"><span style="mso-spacerun:yes"> </span>"htest_pkey" PRIMARY KEY,<span style="mso-spacerun: yes"> </span>btree (new_id)</font></font><pclass="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font color="#000000" face="Courier New">Foreign-keyconstraints:</font><p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font color="#000000"><font face="CourierNew"><span style="mso-spacerun: yes"> </span>"htest_test_cust_id_fkey" FOREIGN KEY (test_cust_id) REFERENCEScustomers(customer_id)</font></font><p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font color="#000000" face="CourierNew">Refrenced by :</font><p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font color="#000000"><font face="CourierNew"><span style="mso-spacerun: yes"> </span>"htest_child_ctest_cust_id_fkey" IN public.htest_child(ctest_cust_id)REFERENCES htest(new_id)</font></font><p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><fontcolor="#000000"><font face="Courier New"><span style="mso-spacerun: yes"> </span>"htest_child1_ctest_cust_id_fkey"IN public.htest_child1(ctest_cust_id) REFERENCES htest(new_id)</font></font><p class="MsoPlainText"style="MARGIN: 0in 0in 0pt"><font color="#000000" face="Courier New"> </font><p class="MsoPlainText"style="MARGIN: 0in 0in 0pt"><font color="#000000" face="Courier New"> </font><p class="MsoPlainText"style="MARGIN: 0in 0in 0pt"><font color="#000000" face="Courier New"> </font><p class="MsoPlainText"style="MARGIN: 0in 0in 0pt"><font color="#000000" face="Courier New"> </font><p class="MsoPlainText"style="MARGIN: 0in 0in 0pt"><font color="#000000" face="Courier New"> </font><p class="MsoPlainText"style="MARGIN: 0in 0in 0pt"><span lang="ES-TRAD" style="mso-ansi-language: ES-TRAD"><font color="#000000"><fontface="Courier New">diff describe.c_orig describe.c</font></font></span><p class="MsoPlainText" style="MARGIN:0in 0in 0pt"><font color="#000000" face="Courier New">1109c1109,1110</font><p class="MsoPlainText" style="MARGIN:0in 0in 0pt"><font color="#000000" face="Courier New"><<span style="mso-spacerun: yes"> </span><spanstyle="mso-spacerun: yes"> </span>*result6 = NULL;</font><p class="MsoPlainText" style="MARGIN:0in 0in 0pt"><font color="#000000" face="Courier New">---</font><p class="MsoPlainText" style="MARGIN: 0in0in 0pt"><font color="#000000" face="Courier New">><span style="mso-spacerun: yes"> </span>*result6 = NULL,</font><p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><fontcolor="#000000" face="Courier New">><span style="mso-spacerun: yes"> </span>*result7= NULL;</font><p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font color="#000000" face="Courier New">1114a1116</font><pclass="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font color="#000000" face="Courier New">><spanstyle="mso-spacerun: yes"> </span>refof_count = 0,</font><p class="MsoPlainText"style="MARGIN: 0in 0in 0pt"><font color="#000000" face="Courier New">1247,1248c1249,1265</font><p class="MsoPlainText"style="MARGIN: 0in 0in 0pt"><font color="#000000" face="Courier New"><<span style="mso-spacerun: yes"> </span>footers = pg_malloc_zero((index_count + check_count + rule_count + trigger_count + foreignkey_count+ inherit</font><p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font color="#000000" face="Courier New">s_count+ 7 + 1)</font><p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font color="#000000" face="Courier New"><<spanstyle="mso-spacerun: yes"> </span>* sizeof(*footers));</font><pclass="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font color="#000000" face="Courier New">---</font><pclass="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font color="#000000" face="Courier New">><span style="mso-spacerun:yes"> </span>/* reference_by count */</font><p class="MsoPlainText" style="MARGIN: 0in0in 0pt"><font color="#000000"><font face="Courier New">> </font></font><p class="MsoPlainText" style="MARGIN: 0in0in 0pt"><font color="#000000" face="Courier New">><span style="mso-spacerun: yes"> </span>printfPQExpBuffer(&buf,"SELECTc.conname,n.nspname,p2.relname,pg_catalog.pg_get_constraintdef(c.oid, true)\</font><pclass="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font color="#000000" face="Courier New">n"</font><p class="MsoPlainText"style="MARGIN: 0in 0in 0pt"><font color="#000000" face="Courier New">><span style="mso-spacerun: yes"> </span>"FROM pg_catalog.pg_class p, pg_catalog.pg_constraint c,<span style="mso-spacerun:yes"> </span>pg_catalog.pg_class p2 \n"</font><p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><fontcolor="#000000" face="Courier New">><span style="mso-spacerun: yes"> </span>",pg_catalog.pg_namespacen WHERE p.oid = '%s' AND c.confrelid = '%s'\n"</font><p class="MsoPlainText" style="MARGIN:0in 0in 0pt"><font color="#000000" face="Courier New">><span style="mso-spacerun: yes"> </span>"AND c.conrelid = p2.oid AND n.oid =p2.relnamespace", oid,oid);</font><pclass="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font color="#000000"><font face="Courier New">> </font></font><pclass="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font color="#000000" face="Courier New">><spanstyle="mso-spacerun: yes"> </span>result7 = PSQLexec(buf.data, false);</font><p class="MsoPlainText"style="MARGIN: 0in 0in 0pt"><font color="#000000" face="Courier New">><span style="mso-spacerun: yes"> </span>if (!result7)</font><p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font color="#000000"face="Courier New">><span style="mso-spacerun: yes"> </span>goto error_return;</font><pclass="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font color="#000000" face="Courier New">><spanstyle="mso-spacerun: yes"> </span>else</font><p class="MsoPlainText" style="MARGIN: 0in 0in0pt"><font color="#000000" face="Courier New">><span style="mso-spacerun: yes"> </span>refof_count= PQntuples(result7);</font><p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font color="#000000"><fontface="Courier New">> </font></font><p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font color="#000000"><fontface="Courier New">> </font></font><p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font color="#000000"face="Courier New">><span style="mso-spacerun: yes"> </span>footers = pg_malloc_zero((index_count+ check_count + rule_count + trigger_count + foreignkey_count + inher</font><p class="MsoPlainText"style="MARGIN: 0in 0in 0pt"><font color="#000000" face="Courier New">its_count + refof_count +<span style="mso-spacerun:yes"> </span>7 + 1) * sizeof(*footers));</font><p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><fontcolor="#000000"><font face="Courier New">> </font></font><p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><fontcolor="#000000"><font face="Courier New">> </font></font><p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><fontcolor="#000000" face="Courier New">1483a1501,1526</font><p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><fontcolor="#000000" face="Courier New">><span style="mso-spacerun: yes"> </span>/* print referencecount details */</font><p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font color="#000000" face="Courier New">><spanstyle="mso-spacerun: yes"> </span>if (refof_count > 0)</font><p class="MsoPlainText" style="MARGIN:0in 0in 0pt"><font color="#000000" face="Courier New">><span style="mso-spacerun: yes"> </span><spanstyle="mso-spacerun: yes"> </span>{</font><p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font color="#000000"face="Courier New">><span style="mso-spacerun: yes"> </span>printfPQExpBuffer(&buf,_("Refrenced by :"));</font><p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font color="#000000"face="Courier New">><span style="mso-spacerun: yes"> </span>footers[count_footers++]= pg_strdup(buf.data);</font><p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font color="#000000"face="Courier New">><span style="mso-spacerun: yes"> </span>for (i = 0; i <refof_count; i++)</font><p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font color="#000000" face="Courier New">><spanstyle="mso-spacerun: yes"> </span>{</font><p class="MsoPlainText" style="MARGIN: 0in0in 0pt"><font color="#000000" face="Courier New">><span style="mso-spacerun: yes"> </span><span style="mso-spacerun:yes"> </span>const char *refbydef;</font><p class="MsoPlainText" style="MARGIN:0in 0in 0pt"><font color="#000000" face="Courier New">><span style="mso-spacerun: yes"> </span>const char *usingpos;</font><p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><fontcolor="#000000" face="Courier New">><span style="mso-spacerun: yes"> </span>printfPQExpBuffer(&buf,_("<span style="mso-spacerun: yes"> </span>\"%s\" IN %s.%s"),</font><p class="MsoPlainText"style="MARGIN: 0in 0in 0pt"><font color="#000000" face="Courier New">><span style="mso-spacerun: yes"> </span><span style="mso-spacerun: yes"> </span>PQgetvalue(result7,i,0),</font><pclass="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font color="#000000" face="CourierNew">><span style="mso-spacerun: yes"> </span>PQgetvalue(result7,i,1),</font><pclass="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font color="#000000" face="CourierNew">><span style="mso-spacerun: yes"> </span>PQgetvalue(result7,i,2));</font><pclass="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font color="#000000"><font face="CourierNew">> </font></font><p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font color="#000000" face="CourierNew">><span style="mso-spacerun: yes"> </span>/* Everything after "FOREIGNKEY " is echoed verbatim */</font><p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font color="#000000" face="CourierNew">><span style="mso-spacerun: yes"> </span>refbydef = PQgetvalue(result7,i, 3);</font><p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font color="#000000" face="Courier New">><spanstyle="mso-spacerun: yes"> </span>usingpos = strstr(refbydef, "FOREIGN KEY");</font><p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font color="#000000" face="Courier New">><span style="mso-spacerun:yes"> </span>if (usingpos)</font><p class="MsoPlainText" style="MARGIN:0in 0in 0pt"><font color="#000000" face="Courier New">><span style="mso-spacerun: yes"> </span>refbydef = usingpos + 12;</font><p class="MsoPlainText" style="MARGIN:0in 0in 0pt"><font color="#000000" face="Courier New">><span style="mso-spacerun: yes"> </span>appendPQExpBuffer(&buf, "%s",refbydef);</font><p class="MsoPlainText" style="MARGIN:0in 0in 0pt"><font color="#000000"><font face="Courier New">> </font></font><p class="MsoPlainText" style="MARGIN:0in 0in 0pt"><font color="#000000" face="Courier New">><span style="mso-spacerun: yes"> </span>footers[count_footers++] = pg_strdup(buf.data);</font><p class="MsoPlainText"style="MARGIN: 0in 0in 0pt"><font color="#000000" face="Courier New">><span style="mso-spacerun: yes"> </span>}</font><p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"><font color="#000000" face="CourierNew">><span style="mso-spacerun: yes"> </span>}</font><p class="MsoPlainText" style="MARGIN:0in 0in 0pt"><font color="#000000"><font face="Courier New">> </font></font><p class="MsoPlainText" style="MARGIN:0in 0in 0pt"><font color="#000000" face="Courier New"> </font> <br /><br /><hr />Live the life in style withMSN Lifestyle. Check out! <a href="http://content.msn.co.in/Lifestyle/Default" target="_new">Try it now!</a>
pgsql-hackers by date: