Re: [HACKERS] tutorial won't compile in current tree.

From: Clark Evans <clark(dot)evans(at)manhattanproject(dot)com>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] tutorial won't compile in current tree.
Date: 1999-03-13 06:42:34
Message-ID: 36EA08DA.63F743F4@manhattanproject.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thoughts:

a) In funcs.c, to get it to compile, simply remove
the concat16 function and replace TUPLE with TupleTableSlot .

b) In funcs.c it does not make sense to fix concat16, it
should just be removed.

First, the fix would make it almost identical to 'text',
only you truncate and pad extra spaces at the end, thus
this extra duplication does little for the tutorial.
I think the tutorial should be modified to use another
fixed length data type, mabye a square? This leads to:

Second, from a procedure/trigger builder's perspective,
a SPI_stringtodatum and SPI_datumtostring make more
sence than having the programmer worry about the
internal representation of the data type, this is what
the conversion functions are for anyway.... thus, I
even see the 'copytext' code being replaced with
something seperated from the internal structure of the
database executor with these conversion functions.

c) In funcs.source I could not get this function to compile..

| clark=>
| clark=> CREATE FUNCTION clean_EMP () RETURNS int4
| clark-> AS 'DELETE FROM EMP WHERE EMP.salary <= 0\;
| clark'> SELECT 1 AS ignore_this'
| clark-> LANGUAGE 'sql';
| ERROR: parser: parse error at or near ""

d) I had a weird problem with the columns not showing up..

> [clark(at)monster clark]$ psql
> Welcome to the POSTGRESQL interactive sql monitor:
> Please read the file COPYRIGHT for copyright terms of POSTGRESQL
>
> type \? for help on slash commands
> type \q to quit
> type \g or terminate with semicolon to execute query
> You are currently connected to the database: clark
>
> clark=> CREATE TABLE EMP (
> clark-> name text,
> clark-> salary int4,
> clark-> age int4,
> clark-> dept char(16)
> clark-> );
> CREATE
> clark=>
> clark=> INSERT INTO EMP VALUES ('Sam', 1200, 16, 'toy');
> INSERT 182188 1
> clark=> INSERT INTO EMP VALUES ('Claire', 5000, 32, 'shoe');
> INSERT 182189 1
> clark=> INSERT INTO EMP VALUES ('Andy', -1000, 2, 'candy');
> INSERT 182190 1
> clark=> INSERT INTO EMP VALUES ('Bill', 4200, 36, 'shoe');
> INSERT 182191 1
> clark=> INSERT INTO EMP VALUES ('Ginger', 4800, 30, 'candy');
> INSERT 182192 1
> clark=> \d emp
>
> Table = emp
> +----------------------------------+----------------------------------+-------+
> | Field | Type | Length|
> +----------------------------------+----------------------------------+-------+
> | name | text | var |
> | dept | char() | 16 |
> +----------------------------------+----------------------------------+-------+
> clark=> select * from emp;
> name |salary|age|dept
> ------+------+---+----------------
> Sam | 1200| 16|toy
> Claire| 5000| 32|shoe
> Andy | -1000| 2|candy
> Bill | 4200| 36|shoe
> Ginger| 4800| 30|candy
> (5 rows)
>

Thomas,

If you still want a patch file, I can work on it Sunday.

:) Clark

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1999-03-14 02:59:12 Re: [HACKERS] tutorial won't compile in current tree.
Previous Message Bruce Momjian 1999-03-13 03:55:03 My webcam