pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: mallah@trade-india.com
To: tgl@sss.pgh.pa.us
Cc: mallah@trade-india.com
Cc: pgsql-admin@postgresql.org
Subject: Re: \d tablename with psql over slow links...
Date: Mon, 24 Feb 2003 08:43:51 +0530 (IST)
Message-ID: <1042.219.65.252.187.1046056431.squirrel@mail.trade-india.com> (raw)
In-Reply-To: <5930.1046019528@sss.pgh.pa.us>
References: <1042.219.65.235.8.1046018279.squirrel@mail.trade-india.com>
	<5930.1046019528@sss.pgh.pa.us>


here is output of
$ diff -c <original> <modified>

sorry i am not too familiar with diff.
















> <mallah@trade-india.com> writes:
>> below is the diff  for describe.c
>
> "diff -c" please.  Without context a diff is essentially worthless, since your version of the
> input file is unlikely to match development sources.
>
> 			regards, tom lane
>
> ---------------------------(end of broadcast)--------------------------- TIP 6: Have you
> searched our list archives?
>
> http://archives.postgresql.org







-----------------------------------------
Get your free web based email at trade-india.com.
   "India's Leading B2B eMarketplace.!"
http://www.trade-india.com/

Attachments:

describe.diff (application/octet-stream, 2.9K) download *** describe.c 2003-02-23 13:11:17.000000000 +0530 --- ../psql/describe.c 2003-02-23 21:17:12.000000000 +0530 *************** *** 636,641 **** --- 636,642 ---- char **ptr; PQExpBufferData title; unsigned int cols = 0; + unsigned int defaultcol = 5; struct { bool hasindex; *************** *** 702,710 **** --- 703,721 ---- printfPQExpBuffer(&buf, "SELECT a.attname,"); appendPQExpBuffer(&buf, "\n pg_catalog.format_type(a.atttypid, a.atttypmod),\n" " a.attnotnull, a.atthasdef, a.attnum"); + if (verbose) appendPQExpBuffer(&buf, ", pg_catalog.col_description(a.attrelid, a.attnum)"); + + /* my code additions 1 */ + appendPQExpBuffer(&buf, ", (SELECT substring(adsrc for 128) FROM pg_catalog.pg_attrdef WHERE adrelid =%s AND adnum = a.attnum ) " , oid ); + /* ends 1 */ + + appendPQExpBuffer(&buf, "\nFROM pg_catalog.pg_attribute a"); + + + if (tableinfo.relkind == 'i') appendPQExpBuffer(&buf, ", pg_catalog.pg_index i"); appendPQExpBuffer(&buf, "\nWHERE a.attrelid = '%s' AND a.attnum > 0 AND NOT a.attisdropped", oid); *************** *** 713,718 **** --- 724,731 ---- appendPQExpBuffer(&buf, "\nORDER BY a.attnum"); res = PSQLexec(buf.data, false); + + if (!res) goto error_return; *************** *** 740,745 **** --- 753,759 ---- { /* Name */ cells[i * cols + 0] = PQgetvalue(res, i, 0); /* don't free this + * afterwards */ /* Type */ cells[i * cols + 1] = PQgetvalue(res, i, 1); /* don't free this *************** *** 751,777 **** { cells[i * cols + 2] = xmalloc(128 + 128); cells[i * cols + 2][0] = '\0'; if (strcmp(PQgetvalue(res, i, 2), "t") == 0) strcat(cells[i * cols + 2], "not null"); /* handle "default" here */ if (strcmp(PQgetvalue(res, i, 3), "t") == 0) { - PGresult *result; - - printfPQExpBuffer(&buf, - "SELECT substring(d.adsrc for 128) FROM pg_catalog.pg_attrdef d\n" - "WHERE d.adrelid = '%s' AND d.adnum = %s", - oid, PQgetvalue(res, i, 4)); - - result = PSQLexec(buf.data, false); - if (cells[i * cols + 2][0]) strcat(cells[i * cols + 2], " "); strcat(cells[i * cols + 2], "default "); - strcat(cells[i * cols + 2], result ? PQgetvalue(result, 0, 0) : "?"); ! PQclear(result); } } --- 765,787 ---- { cells[i * cols + 2] = xmalloc(128 + 128); cells[i * cols + 2][0] = '\0'; + + if (strcmp(PQgetvalue(res, i, 2), "t") == 0) strcat(cells[i * cols + 2], "not null"); /* handle "default" here */ if (strcmp(PQgetvalue(res, i, 3), "t") == 0) { if (cells[i * cols + 2][0]) strcat(cells[i * cols + 2], " "); + strcat(cells[i * cols + 2], "default "); ! if (verbose) ! defaultcol = 6; ! strcat(cells[i * cols + 2], PQgetvalue(res, i, defaultcol ) ); ! } }

view thread (5+ messages)  latest in thread

Message-ID: <1042.219.65.252.187.1046056431.squirrel@mail.trade-india.com>
Permalink:  ../1042.219.65.252.187.1046056431.squirrel@mail.trade-india.com/
Also on:    postgresql.org/message-id/1042.219.65.252.187.1046056431.squirrel@mail.trade-india.com

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: mallah@trade-india.com, tgl@sss.pgh.pa.us
  Subject: Re: \d tablename with psql over slow links...
  In-Reply-To: <1042.219.65.252.187.1046056431.squirrel@mail.trade-india.com>
  References: <1042.219.65.235.8.1046018279.squirrel@mail.trade-india.com> <5930.1046019528@sss.pgh.pa.us> <1042.219.65.252.187.1046056431.squirrel@mail.trade-india.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox