SQL Problem: ERROR: ExecEvalExpr: unknown expression type 108 - Mailing list pgsql-sql

From Michael Klemme
Subject SQL Problem: ERROR: ExecEvalExpr: unknown expression type 108
Date
Msg-id 19990604141449.A573@moa.rhein-main.de
Whole thread Raw
List pgsql-sql
Hallo!

I try to create a web server authentification database for our Apache
using PostgreSQL.
Students will be added to certain groups, group entries need to be
invalidated once in a while.



    klemme@moa:~/Postgres/auth> psql -d authentify -f auth-create-test.sql

    DROP TABLE user;
    DROP
    DROP TABLE ugroup;
    DROP
    -- user entries
    CREATE TABLE user(
    vorname         char(20) NOT NULL,      --Vorname des Benutzers
    name            char(20) NOT NULL,      --Name des Benutzers
    uname        char(10) PRIMARY KEY,  --eindeutiger Benutzername des Benutzers im Server';
    pass            char(16) NOT NULL,      --Paßwort des Benutzers
    changed         date NOT NULL
    );
    NOTICE:  CREATE TABLE/PRIMARY KEY will create implicit index user_pkey for table userCREATE

    -- group entries
    CREATE TABLE ugroup
    (
    uname           char(10) NOT NULL,      --Zeiger auf user
    ugroup          char(10) NOT NULL,      --Name der Gruppe
    expires         date NOT NULL,          --Verfallsdatum
    changed         date NOT NULL);
    CREATE

    CREATE UNIQUE INDEX ugroup_idx ON ugroup (uname,ugroup);
    CREATE

    vacuum;
    VACUUM

    --- Test entries

    insert into user values ('Michael', 'Klemme', 'mklemme', 'xxxx', '04-06-1999');
    INSERT 24895 1
    insert into user values ('Michaela','Klemme','maklemme', 'xxxx', '04-06-1999');
    INSERT 24896 1

    insert into ugroup values ('mklemme', 'Physics', '31-12-1999',  '04-06-1999');
    INSERT 24897 1
    insert into ugroup values ('mklemme', 'Math', '31-12-1999',  '04-06-1999');
    INSERT 24898 1
    insert into ugroup values ('maklemme', 'Math', '31-12-1998', '04-06-1999');
    INSERT 24899 1


    --I need to create a view for the Apache module that only returns user
    --entries if a non-expired group entry exists.
    --The SELECT Statement below works okay.

    SELECT uname, pass FROM user
    WHERE UNAME IN
    (SELECT uname FROM ugroup WHERE expires >=  datetime_date('now'));
    uname     |pass
    ----------+----------------
    mklemme   |xxxx
    (1 row)


    --However, if I use the same statment in a view, I get this error message

    -- view to be accessed by Apache
    DROP VIEW legal_user;
    DROP
    CREATE VIEW legal_user AS
    SELECT uname, pass FROM user
    WHERE UNAME IN
    (SELECT uname FROM ugroup WHERE expires >=  datetime_date('now'));
    CREATE

    SELECT * FROM legal_user;
    ERROR:  ExecEvalExpr: unknown expression type 108
    EOF

ANy help would be greatly appreciated!

Thanks,
Grüße
        Michael
--
Michael Klemme
@home            mklemme@gmx.de /
                 klemme@bankakademie.de / klemme@acm.org
                 PGP: http://www.hmu.auckland.ac.nz/~michael-k/pgp

Attachment

pgsql-sql by date:

Previous
From: Martin Leja
Date:
Subject: Howto convert floats to text?
Next
From: José Soares
Date:
Subject: Re: [SQL] Howto convert floats to text?