Because in our system, calling the slony PL/PGSQL stored procedures
would be easier.  What I'm trying to do is to add a new table at the
same time our system automatically creates one.  What our system will do
is put the new table name into a temp table.  That temp table contains a
trigger to then call a function to add the table to slony.


Below is what I am trying to do.  My apologies in advance as I am new to
this.  Any help would be appreciated.

Mark

---------------------------------


This is what I get from calling the addtable function:

ERROR:  function _slony_cluster.setaddtable(integer, integer, name,
integer, text) does not exist
HINT:  No function matches the given name and argument types. You may
need to add explicit type casts.
CONTEXT:  PL/pgSQL function "slony_ddl" line 10 at SQL statement


-----------------------------------

This is what my PL/PGSQL function looks like to add the table


CREATE OR REPLACE FUNCTION slony_ddl()
  RETURNS "trigger" AS
'
DECLARE
        NewSlonyTableID INTEGER;
BEGIN
        IF NEW.column IS NULL THEN

                -- Brand new table being added to slony

        SELECT count(*) INTO NewSlonyTableID FROM
_slony_cluster.sl_table; -- Obtain last used slony table id from slony
table
        NewSlonyTableID := NewSlonyTableID + 1; -- Increment by one
        SELECT _slony_cluster.setaddtable(1000, NewSlonyTableID, CAST
(NEW.tablename AS name), 1, CAST (New.tablename AS text));

        ELSE
                -- Modifying existing table

        END IF;

        -- Remove row from temp table

        DELETE FROM slony_temp WHERE tablename=NEW.tablename;

        RETURN NEW;

END;
'
  LANGUAGE 'plpgsql' VOLATILE;



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Andrew
Sullivan
Sent: Wednesday, June 14, 2006 10:59
To: [email protected]
Subject: Re: [Slony1-general] Good examples of calling slony
storedprocedures

On Wed, Jun 14, 2006 at 10:42:24AM -0700, Mark Adan wrote:
> I was wondering if where can I find some examples of calling the slony
> stored procedures instead of using slonik?  I want to be able to for
> example add a table into slony.  Thanks

The first question I have is, "Why do you want to do this?"  But the
slonik code is the obvious place to look, since that's how it does
it.

A

-- 
Andrew Sullivan  | [EMAIL PROTECTED]
The whole tendency of modern prose is away from concreteness.
                --George Orwell
_______________________________________________
Slony1-general mailing list
[email protected]
http://gborg.postgresql.org/mailman/listinfo/slony1-general

_______________________________________________
Slony1-general mailing list
[email protected]
http://gborg.postgresql.org/mailman/listinfo/slony1-general

Reply via email to