[comp.databases] Attn: RTIngres GURUs

emuleomo@yes.rutgers.edu (Emuleomo) (06/16/89)

Attn RTingres GURUs.

I am an Informix kind of guy but lately I have been forced? to do some  work in RTingres
but I have run into a few _ROADBLOCKS_.

a) I can't seem to be able to change the schema of a table once it is created.
   For instance; I need to increase the size of a name fld from c15 to c20.
   Also, if this can be done, will Ingres automatically rebuild the table
   like Informix will do?

b) I am experimenting will QBF and VIFRED.  Can you specify multi screen forms 
   in VIFRED and use it in QBF?

Your help is muchO appreciated!! 

Respondez S'il vouz plait  at Email ==>   emuleomo@yes.rutgers.edu

--Emuleomo O.O.

** Research is what I'm doing when I dont know what I'm doing! **
-- 
** Research is what I'm doing when I dont know what I'm doing! **

davek@rtech.rtech.com (Dave Kellogg) (06/19/89)

In article <...> emuleomo@yes.rutgers.edu (Emuleomo) writes:
>
>a) I can't seem to be able to change the schema of a table once it is created.
>   For instance; I need to increase the size of a name fld from c15 to c20.
>   Also, if this can be done, will Ingres automatically rebuild the table
>   like Informix will do?
>

Once a table is created its data definition is fixed.  The way to change the
size of an attribute is to use the copy command to copy out the table, drop
the table, recreate it, and then copy it back in.  I know of a few people 
who have written simple front-ends to do this for you in a forms-based fashion
(it's not terribly hard), and perhaps there is a net-lander who has such a
program to post.

There is a performance argument for this approach because it allows the data
to remain clustered (i.e. adjacent attributes stored adjacently) in at least
one sense of the word.  With many table re-orgs, it's essentially "pay me 
now" (drop/recreate) or "pay me later" (with pointers to attributes stored
in different locations from the base table, increasing I/O).

>b) I am experimenting will QBF and VIFRED.  Can you specify multi screen forms 
>   in VIFRED and use it in QBF?


Yes.  See the section in the QBF manuals on "joindefs" where you create
(or specify) the joins between relations and then QBF will create a default
[multi-table] form that you can edit with VIFRED.

(I am assuming you mean multi-table when you say multi-screen).

Dave Kellogg
Relational Technology New York City
212-952-1400

bg0l+@andrew.cmu.edu (Bruce E. Golightly) (06/19/89)

Sounds like you're looking for an "alter table" command. It isn't there
at present. We've kicked around the idea of writing a utility package to
do this, but we don't have any manpower to spare for the task at present.

I'm not sure what your second question means. If you want the user to be
walked through a series of screens, you probably should be working with
ABF rather than QBF. Note that the latest and greatest versions include
user defined "pop-up" forms, which will allow the creation of really
impressive applications. I'm going to add this feature to the next
incarnation of one of my sub-systems to provide pop-up reference tables.

Bruce

emuleomo@yes.rutgers.edu (Emuleomo) (06/23/89)

Just as a quick followup on my previous question <again for RTI gurus>

IS THERE A WAY TO IMPLEMENT a SERIAL fld in Ingres (as is done in Informix)??

A serial fld is a fld which has ALL the following properties.
(AS defined by Informix software)
a)  It uniquely identifies a row in a table. i.e. it is a key for that row.
b)  It is managed by the DBMS AUTOMATICALLY and a unique value is
    generated for any new row inserted into that table.
c)  It cannot be modified, once generated!

** I dont understand why I (a self proclaimed Informix Guru) am having _such_
a hard time with Ingres.  Maybe I should stop thinking in Informix!
However, I thought that SQL is SQL is SQL! and RDBMS is RDBMS is RDBMS.

Respondez S'Il vouz plait.

--Emuleomo O.O. (emuleomo@yes.rutgers.edu)
-- 
** Research is what I'm doing when I dont know what I'm doing! **

llojd@rivm.UUCP (J.W. Diesel) (06/27/89)

In article <Jun.23.12.01.07.1989.1388@yes.rutgers.edu>, emuleomo@yes.rutgers.edu (Emuleomo) writes:
> 
> Just as a quick followup on my previous question <again for RTI gurus>
> 
> IS THERE A WAY TO IMPLEMENT a SERIAL fld in Ingres (as is done in Informix)??
> 
> A serial fld is a fld which has ALL the following properties.
> (AS defined by Informix software)
> a)  It uniquely identifies a row in a table. i.e. it is a key for that row.
> b)  It is managed by the DBMS AUTOMATICALLY and a unique value is
>     generated for any new row inserted into that table.
> c)  It cannot be modified, once generated!
> 
> ** I dont understand why I (a self proclaimed Informix Guru) am having _such_
> a hard time with Ingres.  Maybe I should stop thinking in Informix!
> However, I thought that SQL is SQL is SQL! and RDBMS is RDBMS is RDBMS.
> 
> Respondez S'Il vouz plait.
> 
> --Emuleomo O.O. (emuleomo@yes.rutgers.edu)
> -- 
> ** Research is what I'm doing when I dont know what I'm doing! **

As I would not want other INFORMIX gurus :=) to be mislead I cannot
resist the temptation of reacting upon Emuleomo's interpretation of the
definition of the informix serial datatype.
a) To my experience the serial datatype DOES NOT enforce unique values (only a
unique index will do this): on insertion of a row containing a serial column
you may, optionally, enter an 'initial' value. This value will be used wether
or not it value is unique !!!
b) DBMS management means that, unless an 'initial value' is given, the inserted
value is the maximum-value incremented by one. Informix seems to 'remember'
the maximum value somewhere since deletion of row(s) containing the maximum
value doesnot change the value to be assigned to future 'serial' insertions.
c) For those who want to update a serial column: alter the datatype to
integer, perform your updates and alter the column back to serial. I'm not
sure if the 'remembered' maximum-value is affected by this action.

Though I'm not familiar with INGRES-SQL you might consider the following
scheme to insert unique values:

INSERT INTO yourtable (serial_column)
    SELECT MAX(serial_column) + 1 FROM yourtable;

Informix does not permit you to use the insert-table in the from clause, maybe
INGRES does. You may of course use a temporary table to store the maxvalue
but that would make you pay a considerable performance penalty *and* it can
cause consistency problems: process A determines max; process B determines max;
process A inserts serial (=max + 1); process B inserts serial ==> A and B
insert same serial !!!

--------------------------

Jan Diesel
National Institute for Public Health and Environment
Laboratory for Air Research
mcvax!rivm!llojd

--------------------------

Wonder how he got there with that name !!!!

moiram@tekcae.CAX.TEK.COM (Moira Mallison) (06/30/89)

In article <1389@rivm05.UUCP> llojd@rivm.UUCP (J.W. Diesel) writes:
>scheme to insert unique values:
>
INSERT INTO yourtable (serial_column)
>    SELECT MAX(serial_column) + 1 FROM yourtable;
>
>Informix does not permit you to use the insert-table in the from clause, maybe
>INGRES does. You may of course use a temporary table to store the maxvalue
>but that would make you pay a considerable performance penalty...

If the table has a heap or hash storage structure, the use of the max
function will result in a sequential scan, which REALLY imposes a 
performance penalty on a table of any size.  (This may also be true
of the isam and btree structures, depending on how smart the query
optimizer is.  Dave?).

I solved this problem by storing the next surrogate key value in
the table with an artificial primary key value. ("DUMMY" in the name
field in my case.   I retrieve it with a direct access, increment it and 
update it.

Moira Mallison
Tektronix, Inc.