I have a bit of a dilemma, I'm fairly new to PG, and not quite sure how
to do this:
I have a DB that has been basically 'forked' - a copy of the original
was made for a handful of users to play with without messing with the
live DB. Now, they would like to know if the changes they have made to
the forked db can be merged back in to the live one. A change to one
column of every row in a certain table. How can I update just that field
in every row of the db without harming the existing data already in that
table?
thanks in advance.
-Todd
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match 4 2454
> the forked db can be merged back in to the live one. A change to one column of every row in a certain table. How can I update just that field in every row of the db without harming the existing data already in that table?
Would something like this work?
UPDATE table1
set table1.columna = table2.columna
from table2
where table1.keyfield = table2.keyfield ;
--
Mike Nolan
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings
On Tue, Feb 17, 2004 at 11:55:55 -0700,
"Hought, Todd" <To*********@ec hostar.com> wrote: I have a bit of a dilemma, I'm fairly new to PG, and not quite sure how to do this: I have a DB that has been basically 'forked' - a copy of the original was made for a handful of users to play with without messing with the live DB. Now, they would like to know if the changes they have made to the forked db can be merged back in to the live one. A change to one column of every row in a certain table. How can I update just that field in every row of the db without harming the existing data already in that table?
To change the data in a column you can just use an update command.
Alter table can be used to change constraints or to change the column
tpye. (The latter is usually done by adding a new column, converting
the old values, dropping the old column, renaming the new column
back to the original name, and then fixing any constraints.)
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postg resql.org so that your
message can get through to the mailing list cleanly
On Tue, 17 Feb 2004, Hought, Todd wrote: I have a bit of a dilemma, I'm fairly new to PG, and not quite sure how to do this: I have a DB that has been basically 'forked' - a copy of the original was made for a handful of users to play with without messing with the live DB. Now, they would like to know if the changes they have made to the forked db can be merged back in to the live one. A change to one column of every row in a certain table. How can I update just that field in every row of the db without harming the existing data already in that table?
If you're running 7.3 or above, look at merging the two databases under
one with different schemes and permissions. then you'd be able to do
updates pretty easily. Otherwise, you're gonna have to export / import
your data from one machine to the other with pg_dump / psql or pg_restore
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend
Could you do...
UPDATE mytable SET mycolumn =
(
SELECT myothercolumn
FROM myothertable
WHERE myothertable.pr imarykey = mytable.primary key
)
Not sure how this works in PostgreSQL, but I do it all the time in
Oracle (note only one table definition in subselect)
thanks!
~ Troy Campano ~
On Tue, 2004-02-17 at 13:55, Hought, Todd wrote: I have a bit of a dilemma, I'm fairly new to PG, and not quite sure how to do this: I have a DB that has been basically 'forked' - a copy of the original was made for a handful of users to play with without messing with the live DB. Now, they would like to know if the changes they have made to the forked db can be merged back in to the live one. A change to one column of every row in a certain table. How can I update just that field in every row of the db without harming the existing data already in that table?
thanks in advance.
-Todd
---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postg resql.org so that your
message can get through to the mailing list cleanly This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Pierre-Luc Soucy |
last post by:
Hi,
I was working on some merge tables this morning and it worked fine, but
after a few unsuccessful table creation requests (I was making some
tests), I could not alter or select from a table for the following reason:
mysql> create table test_table (country CHAR(2) NOT NULL) TYPE=MERGE
UNION=(countries);
Query OK, 0 rows affected (0.00 sec)
|
by: Nils |
last post by:
Hello,
my problem:
I merged about 1.000 Tables with
Create table name (variables) type=merge
union=(table1,table2,...,table1000);
MySQL now creates a tables, but I can't open it. Everytime I get the
|
by: jaykchan |
last post by:
One of the table that is in a merge replication somehow is missing an
index. Strangely, only the table in one of the subscriber of the merge
replication is missing the index; another subscriber and the publisher
of the merge replication don't have this problem.
How should I add the missing index back to that table? My understanding
is that making structural change on a table that is in
merge-replication is different from making change on...
|
by: Private Pyle |
last post by:
AIX 5.1, DB2 8.1.3 64-bit ESE 5 partitions 1 catalog, 4 data.
I have a situation where I have to update 269,000,000 rows in a table
with the value in another table with just about the same number of
records. It's a reporting table and the update is based on the
primary key and both tables are indexed to support to the look up.
Both tables also share the same partitioning key and are in the same
node group.
My first try was to declare...
|
by: Shiraz |
last post by:
Hi
I have a question regarding the functionality of merge modules. Since this
relates to my previous queries, I'll just give you a brief background on the
topic. I had to make an installer for an application which was to share dlls
with another application and these dlls were not self-registering. Someone on
the forum suggested a few methods for the Visual studio installer, but since
I had been using another software, a certain...
| |
by: Brett Romero |
last post by:
If I have a dataset with one table and want to merge another table, how
does merge know which column to match rows on in each table?
For example
Table 1:
personid
firstname
lastname
address
|
by: Ron B |
last post by:
Help!!!
What am I doing wrong? I am working with Office 2003 and am trying to create a command button on an Access form that will create a mail merge in Word from an Access table.
I want to make the mail merge seamless to the user so all they have to do is click on the command button and the letters are generated.
For the button I created an event procedure with the following code:
Private Sub RunLetters_Click()
|
by: amitabh.mehra |
last post by:
I want to trap errors (RI errors), if any, that might turn up during
merge in DB2. Is there some feature like the one in Oracle:
MERGE INTO...
WHEN MATCHED THEN UPDATE...
WHEN NOT MATCHED THEN INSERT...
LOG ERRORS INTO...
I mean is there some LOG ERRORS INTO or an equivalent clause in case
|
by: Michel Esber |
last post by:
Question About Merge
DB2 V8 LUW FP 15.
Hello,
Consider table A (ID integer not null PK, Field2 varchar(50)).
I have the existing following set of rows in the table:
|
by: Henry J. |
last post by:
My app needs to insert thousand value rows into a mostly empty table
(data are read from a file). I can either use inserts, or use merge.
The advantage of using merge is that in the few cases where the table
is not empty, it can take care of the updating part, which makes the
app cleaner.
However, my concern is the merge state would slow dowm the insertion
of new data, since in most cases the table is empty.
So my questions (before I...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |