Error messages trying to update a linked table.

Using PGNP with MS SQL Server, Data Transformation Services (DTS), SQL Server Integration Services (SSIS), Linked Servers, Snapshot and Transactional Replication and more.

Error messages trying to update a linked table.

Postby gnarula » Tue Jul 06, 2010 7:03 pm

I've managed to setup a linked server on an SQL 2005 Server back to a Postgres 8.3.7 server running on RHEL. Select statements using 4 part table name (namely rms...tablename) and usning 'openquery(rms,'select * from tablename')' work just fine. However when I try to run an update statement as follows :

update rms...prclst
set action_code = 'D'
where prodid = '061348' and division = '00001' and location = '00' and cover_grade = 'CA' and cover_series = '8907'

it excutes for about 58 seconds and then terminates with the following error :

Msg 7399, Level 16, State 1, Line 1
The OLE DB provider "PGNP" for linked server "rms" reported an error. The provider reported an unexpected catastrophic failure.
Msg 7343, Level 16, State 4, Line 1
The OLE DB provider "PGNP" for linked server "rms" could not UPDATE table "[rms]...[prclst]". Unknown provider error.

The postgres server logs contain the following entries :

2010-07-06 21:57:47 EDT PID:3448 ERROR: cursor "pgnpcsr1" does not exist
2010-07-06 21:57:47 EDT PID:3448 STATEMENT: CLOSE pgnpcsr1

Any help will be appreciated. I have not tried to use an 'openquery' update yet. I will try that next.

B.T.W. I'm on version 1.3.2152 of PGNP
gnarula
 
Posts: 2
Joined: Tue Jul 06, 2010 6:45 pm

Re: Error messages trying to update a linked table.

Postby Moderator » Wed Jul 07, 2010 12:41 am

Would you send DDL schema for table prclst to support@pgoledb.com?

How many records does the table have?
User avatar
Moderator
Site Admin
 
Posts: 310
Joined: Wed Oct 29, 2008 11:27 pm

Re: Error messages trying to update a linked table.

Postby gnarula » Thu Jul 08, 2010 5:42 am

Here's the DDL for the table :

CREATE TABLE prclst (
"timestamp" character varying(14),
action_code character varying(4),
division character varying(5) NOT NULL,
prodid character varying(22) NOT NULL,
list character varying(5) NOT NULL,
sold_flag character varying(1) NOT NULL,
location character varying(2) NOT NULL,
cover_grade character varying(2) NOT NULL,
cover_series character varying(4) NOT NULL,
start_date character varying(14) NOT NULL,
base_price character varying(8),
list_price character varying(8),
landed_frt character varying(8),
add_on character varying(8)
);


ALTER TABLE ONLY prclst
ADD CONSTRAINT prclst_pkey PRIMARY KEY (prodid, cover_grade, cover_series, list, start_date, location, sold_flag, division);


The table has ~ 710000 rows.
gnarula
 
Posts: 2
Joined: Tue Jul 06, 2010 6:45 pm

Re: Error messages trying to update a linked table.

Postby Moderator » Fri Jul 09, 2010 8:34 am

Thank you for the additional information. I reproduced the issue with large number of rows. Working on a fix now.

In the mean time I recommend you to use OPENQUERY syntax: it works and it is significantly better performer.

Example:
update openquery(rms, 'select * from lzbsale.prclst where prodid = ''061348'' and division = ''00001'' and location = ''00'' and cover_grade = ''CA'' and cover_series = ''8907''')
set action_code = 'D'

Another, even faster way of updating the table uses EXEC syntax, for example:
EXEC ('update lzbsale.prclst set action_code = ''D'' where prodid = ''061348'' and division = ''00001'' and location = ''00'' and cover_grade = ''CA'' and cover_series = ''8907''') AT rms
User avatar
Moderator
Site Admin
 
Posts: 310
Joined: Wed Oct 29, 2008 11:27 pm


Return to SQL Server/DTS/SSIS/Linked servers/Replication

Who is online

Users browsing this forum: No registered users and 1 guest

cron