Skip site navigation (1) Skip section navigation (2)

Create table and update it within one function ?

From: Arnaud Lesauvage <thewild(at)freesurf(dot)fr>
To: pgsql-novice(at)postgresql(dot)org
Subject: Create table and update it within one function ?
Date: 2006-02-03 11:58:19
Message-ID: 43E3455B.9050907@freesurf.fr (view raw or flat)
Thread:
Lists: pgsql-novice
Hi list !

I read in the manual that "Functions and trigger procedures are 
always executed within a transaction established by an outer query".
Should I understand, that there is no way to make complex 
procedures that would create tables AND fill them with data ?

I have a function that is defined as :
CREATE OR REPLACE FUNCTION my_function() RETURNS VOID AS $$
	SELECT create_graph_tables('graph', 'int8');
	UPDATE graph_edges SET cost=1;
$$ LANGUAGE SQL;


The create_graph_tables() function creates a table "graph_edges", 
but when I run this 'CREATE FUNCTION' statement, I have an error 
'relation "graph_edges" does not exist".

Is there no way to do this ?

Thanks a lot !
--
Arnaud


Responses

pgsql-novice by date

Next:From: Øyvind Møller AsbjørnsenDate: 2006-02-03 12:09:03
Subject: How do I interpret the data returned from a DeadLock-Exception?(Java)
Previous:From: A. KretschmerDate: 2006-02-03 10:03:42
Subject: Re: schemas in functions

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group