[SQL] diff databases

2004-12-18 Thread drdani
Hi,
I'm looking for a tool which can compare structure of two databases 
and produce sql commands (ALTER, DROP, CREATE, etc. if needed) which 
could be used then to convert structure of one database to the other.

I would like to use such a tool for postgresql databases especially.
Daniel
---(end of broadcast)---
TIP 6: Have you searched our list archives?
  http://archives.postgresql.org


[SQL] plpsql function problem

2005-01-05 Thread drdani
Hi,
I'm writing a plpgsql function. There is an insert in it (let's say to 
table1). This insert causes to call a trigger function which inserts 
some info to an other table (let's say table2):

function
  .
  insert into table1 ...  --> trigger function (runs after insert)
 .
 insert into table2 ...
  .
  select from table2 ... not found
  .
This info looks to be unavailable inside the function. Can it be made 
availabel or must this whole thing reorgenized?

Daniel
---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
   (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])


[SQL] vararg plpsql function

2005-01-05 Thread drdani
Hi,
Is it possible to create vararg (like in C) functions in language 
plpgsql somehow?

Daniel
---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
   (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])


[SQL] copy rows

2005-02-09 Thread drdani
Hi,
What is the simplest solution in plpgsql to copy some rows in a table?
I would like to do something like:
select some rows
   do for each row
  skip serial field  \
  modify one field   |-- what is the simplest way for this?
  insert as new row  /
Is it possible to insert a record type variable? If yes, how to skip a 
field?

Daniel
---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]


[SQL] force command execution

2005-04-15 Thread drdani
Hi,
Let's suppose I have a plpgsql function like:
...
begin
alter ...
  ...;
insert ...
  ...;
create ...
  ...;
drop ...;
and lot of such commands in any order...
end;
...
(There is no "perform" keyword.)
Sometimes "ALTER" failes becouse it is already done. Sometimes 
"INSERT" failes becouse record already exists. Sometimes "DROP" 
failes bacouse object is already dropped by earlier execution of this 
function. When any of the command fails function has no effect at all 
becouse everything is rolled back.

Is it possible to run this function without rollback effect and just 
skip failures? (Server is 8.0.0-rc1.)

If the only way is putting each command in
begin
perform command;
exception
when others then
NULL;
end;
then I'm looking for a text processing tool which can do this 
"wrapping" automaticaly. I've too much functions and commands in them, 
so hand work is not an option.

Daniel
---(end of broadcast)---
TIP 8: explain analyze is your friend