Subject: New user help

From: "M.J.Ridley" <[email-masked]>
Date: Tue, 11 Feb 92 16:59:06 GMT

A number of queries,comments,pleas for help from a new Postgres user
Some of these problems may have been aired before but they gave us
trouble attempting to implement what seemed like simple
examples from the documentation.

1) text

In reply to a previous query you wrote that the following will append
to the class word

append word (title="something", document="{borrowed, something, blue}")

cf append manager(name ="marge",employees="{"mike", "alice"}")
from the POSTGRES User Manual.

Both will work, the double quotes inside the braces
in the second example being ignored, however the spaces
preceding something, blue and alice are not ignored
but stored hence these instances can only be retrieved with

retrieve (word.all) where word.document[2]=" something"

not

retrieve (word.all) where word.document[2]="something"

Similarly

retrieve (manager.all) where manager.employees[2] = " alice"

succeeds whilst

retrieve (manager.all) where manager.employees[2] = "alice"

fails.

A further problem with these arrays of arrays is that although
you can use manager.employees[2] in the where qualification
of a retrieve statement you cannot retrieve that array element so

retrieve (manager.employees[2])

fails, although

retrieve (manager.employees[2][2])

and

retrieve (manager.employees[1])
succeed.
In fact   retrieve (manager.employees[2]) hangs the monitor.

2) Time Travel

The manual pages claim Absolute Time is specified

Month Day [Hour:Minute:Second] Year

we can only get a time to be accepted with a full specification
including the Hour:Min:Sec part or using "now".
However when quering versions of classes only the date part
of the time appears to be used.
Therefore when we attempted historical queries we got empty
classes only to retry the queries the next day and find that they
did work!
So is the current granularity of time one day ?
We also found that versions created using "now" were not snapshots
that did not have updates propagated from the base class as suggested
in "The POSTGRES Data Model" but acted like other versions with
updates from the base class propagated to the version.

Also the syntax from the User Manual

retrieve (EMP.salary) using EMP[T] where EMP.name ="Sam"

doesnt work although

retrieve (e.salary) using e in EMP[T] where e.name ="sam"

does.

3) Transitive closure

In a number of places eg Postgres Next-Generation Database
Management System oct 91 Comm ACM it is suggested that you
can explode a parts or ancestor hierachy using a retrieve* syntax
e.g.

retrieve* into answer (parent.older) from a in answer
wher parent.younger = "John" or parent.younger = a.older

We cannot get queries like this to work are we doing something wrong?
Is there an alternative ?

Mick Ridley  [email-masked]

---

From: postarch (Postgres Mailing Archive)
Date: Sat, 15 Feb 92 17:50:13 PST

> ...however the spaces

> retrieve (manager.all) where manager.employees[2] = "alice"

The added spaces are the result of a bug in the array code.  It doesn't
skip white space between array elements.  To avoid this problem just make
sure there is no white space in your input string (it will work correctly
in version 4).

> retrieve (manager.employees[2])

This works for me, although for reasons I don't understand it takes a long
time to execute.

> including the Hour:Min:Sec part or using "now".

The date parsing code will be new and improved in version 4.  The input
routine will be *much* more flexible than before, and some of the problems
outlined in previous mailings will be eliminated.  Unfortunately some
flexibility will be lost.  Currently you can specify times from 1902 to
2038 and with the new code the earliest date will be Jan 1 1970.

> updates from the base class propagated to the version.

The time specifications for versions do not work.  When version 3 went
out the query rewrite system was completely rewritten and in the nick
of time versions were made to work using the new system.  Unfortunately
we didn't have time to add time stamping.  I will put it on the "hopefully
get it done before version 4 release date" queue.

> retrieve (e.salary) using e in EMP[T] where e.name ="sam"

I believe the manual syntax is wrong here. The way to specify time ranges
is in the from clause.  Whenever I try to use the keyword 'using' in this
context I get a syntax error from the parser.  After some tests I find that
both of the following work:

	retrieve (EMP.salary) from EMP in EMP[T]
and
	retrieve (e.salary) from e in EMP[T]

> Is there an alternative ?

You cannot do these queries in the current implementation.  Recursive queries
were added a few releases ago, but due to implementation problems they were
removed from the system.

Jeff Meredith
[email-masked]

p.s. The scheduled release date for version 4 is March 1st.