I'm using Postgres. I'm in the middle of the development. I need to create a replica of table ABC. I will name it as XYZ. I tried create table XYZ () inherits(ABC)
. It works ok but when I insert values on XYZ, table ABC is also populated (virtually). I am getting duplicate values when I run query something like this select * from ABC where id = 1
. I get the correct record when I run query like this select * from only ABC where id = 1
.
The this is, I don't want to use 'only'. So, I don't think inheritance is what I need. I just want to ask if there is a way to add column automatically on XYZ when I alter(add column) ABC?
I don't want to create two queries of alter for ABC and XYZ. I need the two tables to have the same columns always. Any idea?
there's a link on page 1. by clicking that link, single record on table ABC will be inserted on table XYZ (by this: 'insert into XYZ as select * from ABC') then the page redirects to page 2. The record inserted on XYZ will be the one to be used on page2. if 'edited', XYZ will be edited. If 'saved and completed', the value on XYZ will modify the record residing on ABC. So basically, table XYZ is just a temporary table. I have three buttons on page 2. – Eleven Feb 27 '15 at 07:06