473,382 Members | 1,348 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Moving a database between servers

I am trying to move a postgresql database from one
server to another. The original server is 7.1.3, and
the new one is 7.3.4.

I went on the old and used the command:
pg_dumpall > dump

On the new:
psql -e < dump

I get this for multiple functions. (Error follows
surrounded by *****'s)

CREATE FUNCTION "transaction_visit" (integer) RETURNS
integer AS '
select visit_id
from (
select *
from visit_history as vh
where sequence = (
select max(sequence)
from visit_history
where vh.firm_id = firm_id
and vh.patient_id =
patient_id
and vh.visit_id = visit_id
)
) as v
where v.firm_id = (select firm_id from
current_transaction)
and v.patient_id = $1
and v.person_id = (select person_id from
current_transaction)
and v.inked is null
' LANGUAGE 'sql';

****ERROR: Relation "current_transaction" does not
exist****
The current_transaction is a TEMPORARY table created
like this:
CREATE FUNCTION "open_session" (integer,integer)
RETURNS integer AS '
create temporary table current_transaction as
select $1 as firm_id,
$2 as person_id,
timeofday()::timestamp as
transaction_timestamp,
timeofday()::timestamp as
history_timestamp;
select 1;
' LANGUAGE 'sql';

How do I get these functions to import correctly if it
fails due to this "current_transaction" table not
being found? (only due to it being a temporarily table
created by a different command)

__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

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

Nov 12 '05 #1
3 5873
Quoting "Michael ." <ph****@yahoo.com>:
I am trying to move a postgresql database from one
server to another. The original server is 7.1.3, and
the new one is 7.3.4.

I went on the old and used the command:
pg_dumpall > dump

On the new:
psql -e < dump

I get this for multiple functions. (Error follows
surrounded by *****'s)

CREATE FUNCTION "transaction_visit" (integer) RETURNS
integer AS '
select visit_id
from (
select *
from visit_history as vh
where sequence = (
select max(sequence)
from visit_history
where vh.firm_id = firm_id
and vh.patient_id =
patient_id
and vh.visit_id = visit_id
)
) as v
where v.firm_id = (select firm_id from
current_transaction)
and v.patient_id = $1
and v.person_id = (select person_id from
current_transaction)
and v.inked is null
' LANGUAGE 'sql';

****ERROR: Relation "current_transaction" does not
exist****
The current_transaction is a TEMPORARY table created
like this:
CREATE FUNCTION "open_session" (integer,integer)
RETURNS integer AS '
create temporary table current_transaction as
select $1 as firm_id,
$2 as person_id,
timeofday()::timestamp as
transaction_timestamp,
timeofday()::timestamp as
history_timestamp;
select 1;
' LANGUAGE 'sql';

How do I get these functions to import correctly if it
fails due to this "current_transaction" table not
being found? (only due to it being a temporarily table
created by a different command)

I had problem moving form 7.1.3 to 7.4 too. The easiest thing to do is to (if
you can) use 7.4's pg_dump. Just setup the TCP/IP connectivity if you don't
have it already and dump using a superuser account.

--
Keith C. Perry, MS E.E.
Director of Networks & Applications
VCSN, Inc.
http://vcsn.com

____________________________________
This email account is being host by:
VCSN, Inc : http://vcsn.com

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 12 '05 #2
"Michael ." <ph****@yahoo.com> writes:
[ SQL function that references a TEMP table ] How do I get these functions to import correctly if it
fails due to this "current_transaction" table not
being found?


I don't think there is any good solution in 7.3, because it will insist
on trying to validate the function body. A hack workaround is to create
the "current_transaction" table (as a plain, not TEMP, table), then
import your dump, then drop the table.

7.4 has a better solution (you can turn off function body checking in
CREATE FUNCTION), and 7.4's pg_dump will use it.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 12 '05 #3
Unfortunately I do not have the ability to update to
7.4, although I did try the quick "hack." It worked
for a few functions but later on in the import it
begins to say that current_transaction does not exist
again. Could you think of any reasonf or this? I
don't see any sort of DROP/DELETE for this table.
(The one I added as a hack to get everytihng to import
correctly, that is...)

Appreciate the help,
Mike
--- Tom Lane <tg*@sss.pgh.pa.us> wrote:
"Michael ." <ph****@yahoo.com> writes:
[ SQL function that references a TEMP table ]

How do I get these functions to import correctly

if it
fails due to this "current_transaction" table not
being found?


I don't think there is any good solution in 7.3,
because it will insist
on trying to validate the function body. A hack
workaround is to create
the "current_transaction" table (as a plain, not
TEMP, table), then
import your dump, then drop the table.

7.4 has a better solution (you can turn off function
body checking in
CREATE FUNCTION), and 7.4's pg_dump will use it.

regards, tom lane

---------------------------(end of
broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Tom Loach | last post by:
I have user that we just migrated his Access database to SQL Server. All went well with the migration, but then he came up with another requirement to be able to replicate the database to a local...
1
by: Ben M. | last post by:
Greetings all, This should be an easy task, and Im sure it is, but as many times as I have tried, I cant seem to get this to work properly. We changed ISPs recently from a shared host to a...
1
by: GuyInTn | last post by:
Hi all, I have been given the task of moving an sql database from one server to another. These servers are not on the same network. I know I can detach the database, copy it to a new location,...
0
by: Mirko Slavko | last post by:
Hi, I have to move two MS SQL 2000 servers from Win 2000 Domain to Windows NT 4.0 domain. This servers have transactional replication set between on one database. Does anyone have detailed...
1
by: Nirbho | last post by:
Hi, I've got a c#.net web app that uses SQl Server 2000. It all works very well on my Development PC, but now I've got to install the app onto some real servers. I have 3 servers: 2 for the web...
3
by: MartyNg | last post by:
I have been looking online for pointers, and read mixed things. I was hoping if I post direct questions here, I could get some solid answers. I work for a small company with less than 10 web...
8
by: rick | last post by:
Hi I m trying to move only stored procedures from one database to another and also onto a database on another server, I tried db2 -x "select text from syscat.procedures where procschema =...
26
by: Bookham Measures | last post by:
Hello We are planning to set-up a load balanced web environment. Accordingly, we are going to change the session management on our website from the classic ASP Session State and session...
1
by: gar598 | last post by:
I don't have much experience moving these types of site, but we're changing sites, and I've been asked to move the site to a new server. It's your typical setup Windows server, ASP.Net 2.0., a few...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.