CREATE RULE "new_rule2" AS ON DELETE TO "public"."klien ts_view"
DO INSTEAD (
DELETE
FROM klients
WHERE (klients.klient _id = old.klient_id);
DELETE
FROM klient_services
WHERE (klient_service s.klient_id = old.klient_id);
);
It's 2 commands, but executing only first. Why?
Stanislaw Tristan
Kyiv, Ukraine
E-mail: st******@i.com. ua 4 3982
"Stanislaw Tristan" <st******@i.com .ua> writes: It's 2 commands, but executing only first. Why?
You didn't show us the view, but I suppose it's an inner join of the two
tables? As soon as you delete the row from the first table, there's no
longer any matching row in the view, so the second command finds no OLD
row to join against.
Consider making the view a LEFT JOIN and being sure to delete from the
righthand table first.
regards, tom lane
---------------------------(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
On Thu, Oct 28, 2004 at 04:32:21AM +0300, Stanislaw Tristan wrote: CREATE RULE "new_rule2" AS ON DELETE TO "public"."klien ts_view" DO INSTEAD (
DELETE FROM klients WHERE (klients.klient _id = old.klient_id);
DELETE FROM klient_services WHERE (klient_service s.klient_id = old.klient_id); );
It's 2 commands, but executing only first. Why?
Tom Lane described the problem in another thread a few years ago: http://archives.postgresql.org/pgsql...6/msg00559.php
"...OLD is essentially a macro for the view. As soon as you delete
a row from foo, there's no longer any such row in the view, so the
delete from bar doesn't find anything to delete."
"What you probably want instead is to make bar reference foo as a
foreign key with ON DELETE CASCADE; then the rule for foobar only
needs to delete from foo explicitly, and the additional delete from
bar is done implicitly by the foreign key trigger."
--
Michael Fuhr http://www.fuhr.org/~mfuhr/
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster
"Stanislaw Tristan" <st******@i.com .ua> writes: It's 2 commands, but executing only first. Why?
You didn't show us the view, but I suppose it's an inner join of the two
tables? As soon as you delete the row from the first table, there's no
longer any matching row in the view, so the second command finds no OLD
row to join against.
Consider making the view a LEFT JOIN and being sure to delete from the
righthand table first.
regards, tom lane
---------------------------(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
On Thu, Oct 28, 2004 at 04:32:21AM +0300, Stanislaw Tristan wrote: CREATE RULE "new_rule2" AS ON DELETE TO "public"."klien ts_view" DO INSTEAD (
DELETE FROM klients WHERE (klients.klient _id = old.klient_id);
DELETE FROM klient_services WHERE (klient_service s.klient_id = old.klient_id); );
It's 2 commands, but executing only first. Why?
Tom Lane described the problem in another thread a few years ago: http://archives.postgresql.org/pgsql...6/msg00559.php
"...OLD is essentially a macro for the view. As soon as you delete
a row from foo, there's no longer any such row in the view, so the
delete from bar doesn't find anything to delete."
"What you probably want instead is to make bar reference foo as a
foreign key with ON DELETE CASCADE; then the rule for foobar only
needs to delete from foo explicitly, and the additional delete from
bar is done implicitly by the foreign key trigger."
--
Michael Fuhr http://www.fuhr.org/~mfuhr/
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: den ryko via .NET 247 |
last post by:
Hello to all.
Please let me know how to define grid view.
When I put following code in to the application file the error ?Type 'GridView' is not defined? persists all the time. Please help me
'Deletes selected data and group rows
Public Sub DeleteSelectedRows(ByVal view As GridView)
'Create a list containing selected row handles
Dim selRowsCount As Integer = view.SelectedRowsCount
|
by: Joe Del Medico |
last post by:
I have two tables A & B and I want to delete all the records in A that
are not in B. Can I do this in the query builder? It seems like a
simple problem.
I can easily find the records in A that aren't in B by using the query
wizard to come up with a query "A without matching B".
I added table A to the query builder and Query "A without matching B"
joined them with the index field (Loan Number) made the query a delete
query and
|
by: Shark |
last post by:
Just a post for anyone else that is having this problem (as I've now
discovered the solution).
The problem is where when looking in the dialog resource view of an
MFC project in Visual Studio .NET (2003 in my case) the dialog sizing
gets garbled and it chops off the edges of the dialog somehow and
renders the user unable to edit the dialog properly without screwing
the sizing up.
Well after months of having this problem I finally...
|
by: Berrywong |
last post by:
I creat a view in MyDlg using
m_pview=new MyView();
I am not sure where I should delete m_pview.
I called destroywindow in MyView and MyDlg, I have tried to delete m_pview
in destructor of MyView or MyDlg or PostNcDestroy() function , but all failed
because "Access violation" at line "delete m_pview".
If I don't delete m_pview, there is "memory leak" at line "m_pview=new
MyView()".
|
by: Daniel |
last post by:
Hi All,
I have question regarding to the read, and update the row in the table.
for example:
user A, read the row of data from the table.
user B, read the row of data from the table as well.
user A, update the row of data. (lock)
user B, update the row of data. (fail due to user A lock)
user A, release the lock. (unlock)
At the user B side, the data auto refresh in the data grid table.
| |
by: Santosh |
last post by:
Dear all i am downloading MS tree view control . i want to change the
font size and font name of the tree view control i am wrtitting code
for it like
if (!Page.IsPostBack)
{
treeview1.FontBold = true;
treeview1.Font.Name = "DVB-TTSurekh";
treeview1.FontSize = Font.FontUnit(14);
|
by: Terry |
last post by:
In short, I'm getting an IOException "Directory is not empty" if I have a
Windows Explorer window open and have a subdirectory selected in the tree
view.
For example, I have a directory path of "C:\TestDelete\Sub1". I have
Windows Explorer open and I have "Sub1" selected in the tree view. There
are no files in any of the directories and none are read-only. If I then
call:
Directory.Delete(@"C:\TestDelete", true); // recursive delete
|
by: D Biegert |
last post by:
While in Forms View, a coworker inadvertantly selected Records/Data Entry and it set her form back at record #1 and erased all data from Form View. She still has access to the data in the Datasheet view, so the data is still there. How can she get her 101 records to show up again in the Form View?
Thanks!
Dawn
|
by: vaskarbasak |
last post by:
Hi All,
we have a large table having 60 lakhs and more data.so we are facing a problem when we are executing insert or update query.
as a result our DB is very slow and sometimes we are facing deadlock , so it is not updated correctly.
storage engine of this table is Inno DB.
we want to access this table by creating views of that table.we want to execute insert , update on that view except using the main table.
will it be a solution...
|
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: 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: 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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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...
| |