Return-Path: pg_adm@postgres.berkeley.edu
Received: by postgres.Berkeley.EDU (5.61/1.29)
	id AA06636; Mon, 26 Jul 93 06:31:47 -0700
Date: Mon, 26 Jul 93 06:31:47 -0700
Message-Id: <9307261331.AA06636@postgres.Berkeley.EDU>
From: shrchin@reading.ac.uk
Subject: casting, execute, name spaces
To: postgres@postgres.berkeley.edu
Sender: pg_adm@postgres.berkeley.edu

Trivial questions from a complete database and postgres novice:

<Q1> casting

   % monitor -q test
   * create EG (num = float8, denom = int4) \g
   CREATE
   * append EG (num = 100.0, denom = 4) \g
   APPEND 20832
   * retrieve (div = EG.num / EG.denom) \g
   NOTICE:Jul 26 13:53:12:there is no operator / for types float8 and int4
   NOTICE:Jul 26 13:53:12:You will either have to retype this query using an
   NOTICE:Jul 26 13:53:12:explicit cast, or you will have to define the operator
   WARN:Jul 26 13:53:12:/ for float8 and int4 using DEFINE OPERATOR
   * retrieve (div = EG.num / EG.denom.int4out.float8in) \g
   ---------------
   | div         |
   ---------------
   | 25          |
   ---------------
   *

There has to be a better way of doing an "explicit cast" than what I did above
but I couldn't find any references to casting in the docs that come with 4.1.
Please enlighten me.



<Q2> execute

INTRODUCTION(COMMANDS) mentions an "execute" keyword.
Does it exist? Should there be a man-page for it?



<Q3> name spaces

(Continuing monitor session from above...)

   * retrieve (EMP.all) \g
   WARN:Jul 26 14:27:14:heap_openr on EMP failed

   * create EMP (name = char16, job = char16) \g
   CREATE
   * append EMP (name = "Jon", job = "annoying people") \g
   APPEND 20990
   * retrieve (EMP.all) \g
   -----------------------------
   | name        | job         |
   -----------------------------
   | jon         | annoying people|
   -----------------------------
   * retrieve (EMP.all) from EMP in EG \g
   -----------------------------
   | num         | denom       |
   -----------------------------
   | 100         | 4           |
   -----------------------------
   *


Does this just indicate that one should always use "from" clauses ?




-jonathan

--
Jonathan H N Chin, 5 kyu | Dept. of Cybernetics, | "Respondeo, etsi mutabor"
                         | University of Reading |
 shrchin@reading.ac.uk   | Box 225, Whiteknights |   < Rosenstock-Huessy >
cybjhnc@cyber.rdg.ac.uk  | Reading, RG6 2AY, UK. |
