Hi guys,

during my study i have to du some practical work. i must extend postgresql with some sampling algorithms. therefore i implemented some trigger functions. it works fine.
but now i have to do some changes concerning the parser, particularly analyze.c . if a user sends an create table command, postgresql should create several sample tables, which will be filled wih the sample data from the original table. for the beginning, it would be enough, if two tables are created, the original one, with table name, columns etc. selectd by the user and second one, a copy with same columns etc, but another name e.g. sample.

my problem is, that the system catalogs are created at "initdb". then the following failure occurs:

loading pg_description... /usr/local/pqsql/initdb: line 837: 22348 Done (141)
           (cat <<EOF
           CREATE TEMP TABLE tmp_pg_description (objoid oid, classname name, objsuboid int4,  description text)
           WITHOUT OIDS;
           COPY tmp_pg_description FROM STDIN;
                                    EOF
           cat  "$POSTGRES_DESC"; cat
                                   <<EOF
\.
          INSERT INTO pg_description SELECT t.objoid, c.oid, t.objsuboid, t.description FROM tmp_pg_description t,
          pg_class c WHERE c.relname = t.classname;
                                  EOF)
22349 Segmentation fault " $PGPATH"/postgres $PGSQL_OPT template1>/dev/null

how can i tell postgres. that it should only create the sample table, when the original table to be created has the name "origin" or something like that? or that it should only act, if some user wants to create the table, not postgres itself? 

thank you very much!

greetings, anja
_______________________________________________________
WEB.DE Video-Mail - Sagen Sie mehr mit bewegten Bildern
Informationen unter: http://freemail.web.de/?mc=021199


Fri, 16 Jul 2004 11:41:59 +0200
"Anja Klein" <Kruemelmonster_81@web.de>
analyze.c
Anja Klein wrote:
> how can i tell postgres. that it should only create the sample table,
> when the original table to be created has the name "origin" or
> something like that? or that it should only act, if some user wants
> to create the table, not postgres itself?

You would presumably do a strcmp() on the name of the table to be 
created before you jump into your new code that creates the sample 
table.

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/


Fri, 16 Jul 2004 19:56:25 +0200
Peter Eisentraut <peter_e@gmx.net>
Re: analyze.c