Re: new psql \d command - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: new psql \d command
Date
Msg-id 200308082105.h78L5Au22046@candle.pha.pa.us
Whole thread Raw
In response to Re: new psql \d command  ("Christopher Kings-Lynne" <chriskl@familyhealth.com.au>)
List pgsql-hackers
Christopher Kings-Lynne wrote:
> > I assume we don't want them always quoted.
>
> Problem with that is that someone has to move the to-quote-or-not function
> from pg_dump into psql...

Attached is a psql/Makefile patch that makes fmtId() available to psql C
code.

I tried a test and it seemed to work.  Keep in mind the return value of fmtId()
has to be used before fmtId() is called again, so places that pass two
parameters to printf will need to call fmtId(), save the result, then
call it again and pass them both to printf.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/bin/psql/Makefile
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/psql/Makefile,v
retrieving revision 1.37
diff -c -c -r1.37 Makefile
*** src/bin/psql/Makefile    8 Aug 2003 04:52:21 -0000    1.37
--- src/bin/psql/Makefile    8 Aug 2003 20:48:41 -0000
***************
*** 15,25 ****

  REFDOCDIR= $(top_srcdir)/doc/src/sgml/ref

! override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS) -DFRONTEND

  OBJS=    command.o common.o help.o input.o stringutils.o mainloop.o copy.o \
      startup.o prompt.o variables.o large_obj.o print.o describe.o \
!     tab-complete.o mbprint.o

  all: submake-libpq submake-libpgport psql

--- 15,26 ----

  REFDOCDIR= $(top_srcdir)/doc/src/sgml/ref

! override CPPFLAGS := -I$(top_srcdir)/src/bin/pg_dump -I$(libpq_srcdir) $(CPPFLAGS) -DFRONTEND

  OBJS=    command.o common.o help.o input.o stringutils.o mainloop.o copy.o \
      startup.o prompt.o variables.o large_obj.o print.o describe.o \
!     tab-complete.o mbprint.o \
!     dumputils.o $(top_builddir)/src/backend/parser/keywords.o

  all: submake-libpq submake-libpgport psql

***************
*** 27,32 ****
--- 28,36 ----
      $(CC) $(CFLAGS) $(OBJS) $(libpq) $(LDFLAGS) $(LIBS) -o $@

  help.o: $(srcdir)/sql_help.h
+
+ dumputils.c: % : $(top_srcdir)/src/bin/pg_dump/%
+     rm -f $@ && $(LN_S) $< .

  ifdef PERL
  $(srcdir)/sql_help.h: create_help.pl $(wildcard $(REFDOCDIR)/*.sgml)

pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: WITH HOLD and pooled connections
Next
From: Bruce Momjian
Date:
Subject: Re: WITH HOLD and pooled connections