Dear list,
i am looking for a way to check, whether an DML-statement can be
performed on a current database. That means, that i want to check, if
e.g. an INSERT is possible or not (due to existing constraints), without
executing it.
Any ideas?
Hagen
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html 1 1542
Hagen Hoepfner wrote: i am looking for a way to check, whether an DML-statement can be performed on a current database. That means, that i want to check, if e.g. an INSERT is possible or not (due to existing constraints), without executing it.
I think this could be the easiest way: try it and rollback.
BEGIN;
SET CONSTRAINTS ALL IMMEDIATE; -- if you have deferred foreign key, e.g.
INSERT .... -- check if it works
ROLLBACK;
That should do what you want, IMHO.
In PostgreSQL 8.0 you would not need your own transaction here...
BEGIN;
-- do some work
SAVEPOINT check_dml;
INSERT ... -- check if it works
ROLLBACK TO check_dml;
-- do some more work
COMMIT;
Could this be what you want?
Best Regards,
Michael Paesold
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postg resql.org This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: kerri |
last post by:
Hi,
I need to do a mysqldump of specific inserts, updates & deletes. I
read in the docs that I can use -w or --where.
Can I do a join?
Could someone provide an example?
Is there another way?
|
by: Viswanatha Thalakola |
last post by:
Hello,
Can someone point me to getting the total number of inserts and updates on a table
over a period of time?
I just want to measure the insert and update activity on the tables.
Thanks.
- Vish
|
by: Durai |
last post by:
Hi All,
I tested "concurrent testing" in MySQL. It works fine. But I couldn't do in PostgreSQL 7.3.4 on HPUX IPF. I got deadlock problem. I used the PHP script to update table( one script increment the column & another one decrement the column). Is the postgres support the concurrent access to update database?
I got the following errors:
test=# ERROR: deadlock detected
ERROR: deadlock detected
ERROR: deadlock detected
.....
|
by: peter |
last post by:
Hi All,
a quick question.
I haven't used DB2 on mainframe since 1995 so my memory is fading a
bit. But I seem to recall DB2/MVS having the ability to perform
unlogged deletes.
Situation is I have an oracle partition with 500M rows in it and I need
to update 60M rows and I expect the logging of updates will be too
much...I had proposed that the rows be deleted using unlogged deletes
|
by: Steve - DND |
last post by:
Is there a way to perform multiple inserts and updates to SQL Server with
stored procedures and the Command object's named parameters all at once? The
only way to do this that I'm gathering so far is to either run each
insert/update individually, or to write out each SP execution string with
it's parameters separated by semi-colons, and run it that way. Any help
would be appreciated.
Thanks,
Steve
| |
by: R.A.M. |
last post by:
Please help.
I have a table with single row. I need to allow only UPDATEs of the
table, forbid INSERTs and DELETEs. How to achieve it?
Thank you for information
/RAM/
|
by: Rob |
last post by:
Hi all,
I have a bit of a complicated question, hope we have an SQL guru out there
that can help us solve this killer problem.
Due to the size of SQL Database we have (largest in the US), we try to
pre-process large data files in IO until we are ready to insert directly into
the database via BCP (quick, no constraints, no mess... well um that's the
problem)
|
by: Benzine |
last post by:
I recently rolled out replication on our production server (MS SQL 2000
SP4) and every time a subscriber tries to sync the following always
appears in the Merge Agent History:
"Downloaded 100 data changes (0 inserts, 100 updates, 0 deletes, 0
conflicts)"
Then at the very end of the "Action Messages" the following appears:
"Merged 31489 data changes (453 inserts, 30893 updates, 143 deletes, 14
|
by: MihirShah |
last post by:
If I insert rows in a table with no index, is select guaranteed to return the rows in the order it was inserted.
Note: I am not doing any updates, deletes - pure inserts.
In my small test that I did, it always retrieves in the order I inserted. But not sure if there are any case where it can retrieve in a different order.
|
by: Dimitris Milonas |
last post by:
Hello to all,
I have a DetailView on a page with Insert/Update enable and Paging enable. I
would like to have on the same page two buttons ("Submit" and "Cancel")
where with the first ("Submit") all the entries will be passed to the
database (Inserts - Updates - Deletes) while with the second ("Cancel") all
changes will be discarded.
Is it possible?
I' am using DataSet and DataAdapter and I have to execute
Adapter.Update(DataTable)...
|
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: 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: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
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...
| | |