Re: [PATCHES] Reference by output in : \d table_name
Hi Brendan, I thought you were referring to the spaces sourrounding the word FOREIGN KEY on the last line and hence my explaination was out of place.I am glad that you have corrected the indentation to 4 spaces. Those were unintentional at 2 spaces from myside. However,Why does the word FOREIGN KEY appear in the last line of your output. My original patch had the output like this. Referenced by: bar_foo_fkey IN public.bar(foo) REFERENCES foo(a) The keyword FOREIGN KEY was removed by me as it would further cause a confusion. Secondly, since the table foo is altered with an addition of a new column bar, it doesn't display in your output. Please double check. My output is looking like this: testdb=# \d foo Table public.foo Column | Type | Modifiers+-+--- a | integer | not null bar| integer | not null/* Brendan--this line is missing in your output */Indexes:foo_pkey PRIMARY KEY, btree (a)Foreign-key constraints: foo_bar_fkey FOREIGN KEY (bar) REFERENCES bar(a)Referenced by: bar_foo_fkey IN public.bar(foo) REFERENCES foo(a) /* please ignore the 2 space indent, I am still using my orignal patch. I will correct it later */ Thanks,Kenneth Date: Mon, 14 Apr 2008 11:04:35 -0400 From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] CC: [EMAIL PROTECTED]; [EMAIL PROTECTED]; pgsql-patches@postgresql.org Subject: Re: [PATCHES] Reference by output in : \d table_name Brendan Jurd escribió: Yeah, that's what I figured. The patch I attached to my previous email should fix it up. Applied, thanks. -- Alvaro Herrera http://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support _ Fashion Channel : Want to know what’s the latest in the fashion world ? You have it all here on MSN Fashion. http://lifestyle.in.msn.com/
Re: [PATCHES] Reference by output in : \d table_name
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Wed, Apr 16, 2008 at 10:00 PM, kenneth d'souza wrote: However,Why does the word FOREIGN KEY appear in the last line of your output. My original patch had the output like this. Referenced by: bar_foo_fkey IN public.bar(foo) REFERENCES foo(a) The keyword FOREIGN KEY was removed by me as it would further cause a confusion. Hi Kenneth, Tom reinstated the FOREIGN KEY part of the definition when he committed your patch. I think it's fine with FOREIGN KEY left in there; I don't find it confusing. I actually think it makes the line more descriptive and obvious. Secondly, since the table foo is altered with an addition of a new column bar, it doesn't display in your output. Please double check. You're right; it was just a copy-paste error I made when I was composing my email. The actual output from psql shows all columns as expected. Cheers, BJ -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (GNU/Linux) Comment: http://getfiregpg.org iD8DBQFIBixv5YBsbHkuyV0RArJSAJ0eDes2V0nwlgQuNE0GjJxwW4Ey8gCgiWTw UjSjF8EJaTDSTQnkTfgSasY= =xdOl -END PGP SIGNATURE- -- Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-patches
Re: [PATCHES] Reference by output in : \d table_name
Hi Brendan, Your observation is correct. The indentation is deliberate. The reason is that the (result7,i,3) starts with the word FOREIGN KEY . I am using the details that follow after this blurb. All other keywords which are searched in usingpos = strstr(indexdef, KEYWORD ) , the KEYWORD are embedded somewhere in between in the output. Hence indentation given is that of four spaces considering the final output that it is desired. Thanks, Kenneth _ Tried the new MSN Messenger? It’s cool! Download now. http://messenger.msn.com/Download/Default.aspx?mkt=en-in
Re: [PATCHES] Reference by output in : \d table_name
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Mon, Apr 14, 2008 at 11:42 PM, Tom Lane wrote: Brendan Jurd writes: Sorry Kenneth, I didn't quite follow your explanation. How does the position of FOREIGN KEY affect the indentation at the beginning of the footer? I changed that patch around a bit while applying it, and very possibly fat-fingered the indentation FWIW, I think the deviant indentation was present in the original patch submitted by Kenneth. I compared your commit with the patch, and the initial two-space indent is clearly there in both diffs. --- I don't recall having explicitly compared it to the other cases. It surely should be consistent with everything else. Yeah, that's what I figured. The patch I attached to my previous email should fix it up. Cheers, BJ -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (GNU/Linux) Comment: http://getfiregpg.org iD8DBQFIA2J55YBsbHkuyV0RAjpxAKCy+pzCV8h88k5PcdwD8ik86Ka1PACffVOO K2rItDy0yWlvTxZpArpXU0o= =vLyi -END PGP SIGNATURE- -- Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-patches
Re: [PATCHES] Reference by output in : \d table_name
Brendan Jurd escribió: Yeah, that's what I figured. The patch I attached to my previous email should fix it up. Applied, thanks. -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support -- Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-patches
Re: [PATCHES] Reference by output in : \d table_name
On Mon, Mar 31, 2008 at 3:50 AM, Tom Lane [EMAIL PROTECTED] wrote: kenneth d'souza [EMAIL PROTECTED] writes: With reference to the post http://archives.postgresql.org/pgsql-patches/2008-02/msg00104.phpand as stated by -hackers and -patchers, I am submitting the diff -c output as an attachment. Thanks, Kenneth Applied with some revisions. While working on my printTable patch, I noticed that this patch only has an indent of two spaces for incoming foreign keys, while all the other table footers have an indent of four spaces. Was this deliberate? And if so, why the change in indentation for this particular listing? Cheers, BJ -- Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-patches
Re: [PATCHES] Reference by output in : \d table_name
kenneth d'souza [EMAIL PROTECTED] writes: With reference to the post http://archives.postgresql.org/pgsql-patches/2008-02/msg00104.phpand as stated by -hackers and -patchers, I am submitting the diff -c output as an attachment. Thanks, Kenneth Applied with some revisions. regards, tom lane -- Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-patches
Re: [PATCHES] Reference by output in : \d table_name
Your patch has been added to the PostgreSQL unapplied patches list at: http://momjian.postgresql.org/cgi-bin/pgpatches It will be applied as soon as one of the PostgreSQL committers reviews and approves it. --- kenneth d'souza wrote: With reference to the post http://archives.postgresql.org/pgsql-patches/2008-02/msg00104.phpand as stated by -hackers and -patchers, I am submitting the diff -c output as an attachment. Thanks, Kenneth _ Tried the new MSN Messenger? It?s cool! Download now. http://messenger.msn.com/Download/Default.aspx?mkt=en-in [ Attachment, skipping... ] -- Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org) To make changes to your Subscription: http://mail.postgresql.org/mj/mj_wwwusr?domain=postgresql.orgextra=pgsql-patches -- Bruce Momjian [EMAIL PROTECTED]http://momjian.us EnterpriseDB http://postgres.enterprisedb.com + If your life is a hard drive, Christ can be your backup. + -- Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org) To make changes to your Subscription: http://mail.postgresql.org/mj/mj_wwwusr?domain=postgresql.orgextra=pgsql-patches
[PATCHES] Reference by output in : \d table_name
With reference to the post http://archives.postgresql.org/pgsql-patches/2008-02/msg00104.phpand as stated by -hackers and -patchers, I am submitting the diff -c output as an attachment. Thanks, Kenneth _ Tried the new MSN Messenger? It’s cool! Download now. http://messenger.msn.com/Download/Default.aspx?mkt=en-inIndex: describe.c === RCS file: /projects/cvsroot/pgsql/src/bin/psql/describe.c,v retrieving revision 1.164 diff -c -r1.164 describe.c *** describe.c 1 Jan 2008 19:45:56 - 1.164 --- describe.c 3 Mar 2008 04:10:55 - *** *** 1106,1117 *result3 = NULL, *result4 = NULL, *result5 = NULL, ! *result6 = NULL; int check_count = 0, index_count = 0, foreignkey_count = 0, rule_count = 0, trigger_count = 0, inherits_count = 0; int count_footers = 0; --- 1106,1119 *result3 = NULL, *result4 = NULL, *result5 = NULL, ! *result6 = NULL, ! *result7 = NULL; int check_count = 0, index_count = 0, foreignkey_count = 0, rule_count = 0, trigger_count = 0, + referenceby_count = 0, inherits_count = 0; int count_footers = 0; *** *** 1244,1251 else inherits_count = PQntuples(result6); ! footers = pg_malloc_zero((index_count + check_count + rule_count + trigger_count + foreignkey_count + inherits_count + 7 + 1) !* sizeof(*footers)); /* print indexes */ if (index_count 0) --- 1246,1268 else inherits_count = PQntuples(result6); ! /* reference_by count */ ! ! printfPQExpBuffer(buf,SELECT c.conname,n.nspname,p2.relname,pg_catalog.pg_get_constraintdef(c.oid, true)\n ! FROM pg_catalog.pg_class p, pg_catalog.pg_constraint c, pg_catalog.pg_class p2 \n ! ,pg_catalog.pg_namespace n WHERE p.oid = '%s' AND c.confrelid = '%s'\n ! AND c.conrelid = p2.oid AND n.oid =p2.relnamespace, oid,oid); ! ! result7 = PSQLexec(buf.data, false); ! if (!result7) ! goto error_return; ! else ! referenceby_count = PQntuples(result7); ! ! ! footers = pg_malloc_zero((index_count + check_count + rule_count + trigger_count + foreignkey_count + inherits_count + referenceby_count + 7 + 1) * sizeof(*footers)); ! ! /* print indexes */ if (index_count 0) *** *** 1481,1486 --- 1498,1529 } } + /* print reference count details */ + if (referenceby_count 0) + { + printfPQExpBuffer(buf, _(Refrenced by :)); + footers[count_footers++] = pg_strdup(buf.data); + for (i = 0; i referenceby_count; i++) + { + const char *refbydef; + const char *usingpos; + printfPQExpBuffer(buf, _( \%s\ IN %s.%s), + PQgetvalue(result7,i,0), + PQgetvalue(result7,i,1), + PQgetvalue(result7,i,2)); + + /* Everything after FOREIGN KEY is echoed verbatim */ + refbydef = PQgetvalue(result7, i, 3); + usingpos = strstr(refbydef, FOREIGN KEY ); + if (usingpos) + refbydef = usingpos + 12; + appendPQExpBuffer(buf, %s,refbydef); + +
[PATCHES] Reference by output in : \d table_name
Hi, Refering to this request http://momjian.us/mhonarc/patches_hold/msg00022.htmlI have created a patch. The output doesn't exaclty match with what is stated here http://momjian.us/mhonarc/patches_hold/msg00023.html. However, it does tell the required details in a similar format. Comments? Thanks, Kenneth osdb_pgarch=# \d htest Table public.htestColumn| Type | Modifiers--+---+--- new_id | integer | not null test_name| character(20) | test_cust_id | integer |Indexes:htest_pkey PRIMARY KEY, btree (new_id)Foreign-key constraints: htest_test_cust_id_fkey FOREIGN KEY (test_cust_id) REFERENCES customers(customer_id)Refrenced by : htest_child_ctest_cust_id_fkey IN public.htest_child(ctest_cust_id) REFERENCES htest(new_id) htest_child1_ctest_cust_id_fkey IN public.htest_child1(ctest_cust_id) REFERENCES htest(new_id) diff describe.c_orig describe.c1109c1109,1110 *result6 = NULL;--- *result6 = NULL, *result7 = NULL;1114a1116 refof_count = 0,1247,1248c1249,1265 footers = pg_malloc_zero((index_count + check_count + rule_count + trigger_count + foreignkey_count + inherits_count + 7 + 1) * sizeof(*footers));--- /* reference_by count */ printfPQExpBuffer(buf,SELECT c.conname,n.nspname,p2.relname,pg_catalog.pg_get_constraintdef(c.oid, true)\n FROM pg_catalog.pg_class p, pg_catalog.pg_constraint c, pg_catalog.pg_class p2 \n ,pg_catalog.pg_namespace n WHERE p.oid = '%s' AND c.confrelid = '%s'\n AND c.conrelid = p2.oid AND n.oid =p2.relnamespace, oid,oid); result7 = PSQLexec(buf.data, false); if (!result7) goto error_return; else refof_count = PQntuples(result7); footers = pg_malloc_zero((index_count + check_count + rule_count + trigger_count + foreignkey_count + inherits_count + refof_count + 7 + 1) * sizeof(*footers));1483a1501,1526 /* print reference count details */ if (refof_count 0) { printfPQExpBuffer(buf, _(Refrenced by :)); footers[count_footers++] = pg_strdup(buf.data); for (i = 0; i refof_count; i++) { const char *refbydef; const char *usingpos; printfPQExpBuffer(buf, _( \%s\ IN %s.%s), PQgetvalue(result7,i,0), PQgetvalue(result7,i,1), PQgetvalue(result7,i,2)); /* Everything after FOREIGN KEY is echoed verbatim */ refbydef = PQgetvalue(result7, i, 3); usingpos = strstr(refbydef, FOREIGN KEY ); if (usingpos) refbydef = usingpos + 12; appendPQExpBuffer(buf, %s,refbydef); footers[count_footers++] = pg_strdup(buf.data); } } _ Tried the new MSN Messenger? It’s cool! Download now. http://messenger.msn.com/Download/Default.aspx?mkt=en-in
Re: [PATCHES] Reference by output in : \d table_name
On Mon, Feb 25, 2008 at 5:05 PM, kenneth d'souza [EMAIL PROTECTED] wrote: Refrenced by : htest_child_ctest_cust_id_fkey IN public.htest_child(ctest_cust_id) REFERENCES htest(new_id) htest_child1_ctest_cust_id_fkey IN public.htest_child1(ctest_cust_id) REFERENCES htest(new_id) Very cool! Cheers, BJ ---(end of broadcast)--- TIP 7: You can help support the PostgreSQL project by donating at http://www.postgresql.org/about/donate