Subject: Remove attribute?

From: Patchaya Pitakpaivan <[email-masked]>
Date: Mon, 26 Jul 93 14:31:17 -0700

Hi,

I am writing a C program that interfaces with POSTGRES backend, using LIBPQ.
POSTGRES that we have here is Version 4.0. I have some questions :

1. From the reference manual we can add attribute to a class using ADDATTR.
Is it possible to remove attributes from a class? If it is, what is the command
to be used?

2. When using monitor to retrieve instances of the class, the result that 
POSTGRES displays is in the table form, like :

Query sent to backend is "retrieve (emp.all)"
-----------------------------
| name        | address     |
-----------------------------
| Michael Smith| 2308 Right Street|
-----------------------------
| John Luke Picard| Enterprise 101|
-----------------------------

Can we adjust the format of the table so that the columns width is wider and 
the table is in more "good looking" form?

3. In my program, I try to display the instances of the class in X window. Are
there any commands that I can retrieve all instances of the class with its 
attribute names (as heading) without having to pass all instances through portal.
I try to use copy command and then use PQgetline. But the result is not in good 
format and there is no heading for those instances.

4. Last question. I want to implement the extended relational operators in 
POSTGRES. Is FASTPATH the only way to do this? How can I get more information
about FASTPATH?

Any suggestions would be very appreciated.

Thank you.

Patchaya Pitakpaivan.
Graduate student.
University of Southwestern Louisiana.
Lafayette. Louisiana.

email : [email-masked]

---

From: "David J. Hughes" <[email-masked]>
Date: Mon, 26 Jul 93 17:23:25 -0700

> the table is in more "good looking" form?

Another option is to fire up the Postgres capable Perl and use the
formated output capabalities of Perl for this sort of task.  I use PGPerl
as a report writer on a regular basis.  The PGPerl extensions should be in
the contrib area of your postgres source tree.

> format and there is no heading for those instances.

If I read this correctly, you want to gather the attribute names etc. for
display purposes.  If that's the case, some code I wrote could help you. 
It's a utility I wrote a while back when I started using Postgres as a
backend for a network management system I'm developing.  It allows you to
brows through the structure of a database showing attributes and types
etc. in a textual format.  You could cut and past some of the code to do
this under X (my NMS uses code from this utiulity under Motif). 

It's called relshow and is available from :-

	Hostname	kirk.Bond.edu.au
	IP Addr		131.244.1.1
	Path		/pub/Bond_Uni/relshow/relshow.tar.Z

If I didn't read your question correctly, forget I even mentioned it :-)

   ___                                  David J. Hughes    [email-masked]
  /   \                /  /    /        
 /  __/ __   __   ____/  /    / __            Senior Network Programmer
/    \ /  \ /  \ /   /  /    / /  \  /     Information Technology Services
\____/ \__//   / \__/   \___/ /   / /   Qld. 4229  AUSTRALIA  (+61 75 951450)