<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Forum PostgreSQL - On Update Cascade]]></title>
		<link>https://forum.postgresql.org.pl/viewtopic.php?id=77</link>
		<description><![CDATA[Najświeższe odpowiedzi w On Update Cascade.]]></description>
		<lastBuildDate>Sat, 20 Dec 2008 21:24:11 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Odp: On Update Cascade]]></title>
			<link>https://forum.postgresql.org.pl/viewtopic.php?pid=430#p430</link>
			<description><![CDATA[Hmm nie wiem czy dobrze zrozumiałem.
Zakładasz CONSTRAINTy na idki aby zachować spójność danych w bazie.
Zmieniasz dane w tabeli A i chcesz aby zmiany przeniosły się do B?

Nie lepszy by byłby trigger after update na tabeli a,ktory zrobi update na tabeli b?]]></description>
			<author><![CDATA[dummy@example.com (psocha)]]></author>
			<pubDate>Sat, 20 Dec 2008 21:24:11 +0000</pubDate>
			<guid>https://forum.postgresql.org.pl/viewtopic.php?pid=430#p430</guid>
		</item>
		<item>
			<title><![CDATA[On Update Cascade]]></title>
			<link>https://forum.postgresql.org.pl/viewtopic.php?pid=267#p267</link>
			<description><![CDATA[Witam. mÓj problem dotyczy właśnie ON UPDATE CASCADE otóż:
mam sobie dwie tabele A i B
w tabeli a trzymam pewne wartości a w B tymczasowe wartości z tabeli A i teraz chodzi o to że jeżeli założe ograniczenie na tabele B -> ON UPDATE CASCADE ON DELETE CASCADE to po usunięciu pozycji z tabeli A usuwa się automatycznie pozycja z tabeli B i o to mi właśnie chodziło ale kiedy zmieniam dane w tabeli A nie automatycznie powinny zmienić się w tabeli B i tu jest mój problem gdyż zmieniam dane w A a w B pozostają takie jakie były na początku dodania do B.

Może zagmatwałem ale chodzi o to że ON UPDATE CASCADE mi nie działa chyba że źle coś robię.
moje dwie tabele to:
CREATE TABLE kartoteki.A(
id_tow bigserial not null, 
id_index int not null, 
id_klient int not null, 
id_towaru int not null, 
flag boolean not null, 
nazwa_tow varchar(128) not null, 
nazwa_fiskalna varchar(16) null,
nr_fvz varchar(32) not null, 
id_jm integer not null, 
id_typ text not null, 
ilosc float not null, 
cena float not null, 
cena_sprz float not null, 
sn varchar(128) null, 
created_by integer null, 
modified_by integer null, 
created_date date null, 
modified_date date null, 
opis text null, 
gwarancja varchar(64) null, 
vat varchar(16) not null, 
tabela text not null, 
PRIMARY KEY(id_tow), 
CONSTRAINT id_klient FOREIGN KEY (id_klient) REFERENCES kartoteki.zestawy_skladane (id) ON UPDATE NO ACTION ON DELETE NO ACTION, CONSTRAINT id_index FOREIGN KEY (id_index) REFERENCES kartoteki.lista_zestawu (id) ON UPDATE NO ACTION ON DELETE NO ACTION, CONSTRAINT id_jm FOREIGN KEY (id_jm) REFERENCES kartoteki.jednostki_miar (id) ON UPDATE NO ACTION ON DELETE NO ACTION, CONSTRAINT id_typ FOREIGN KEY (id_typ) REFERENCES kartoteki.typ_towarow (nazwa_typu) ON UPDATE NO ACTION ON DELETE NO ACTION);

CREATE TABLE tmp.B(
id bigserial not null, 
id_tow_ref bigint not null,
 id_towaru bigint null, 
flag boolean not null, 
dodal integer not null, 
nazwa varchar(128) not null, 
nazwa_fiskalna varchar(16) null, 
nr_fvz varchar(32) null, 
id_jm integer not null,
id_typ text null, 
ilosc float not null, 
cena float not null, 
cena_sprz float not null, 
sn varchar(128) null, 
created_by integer null, 
modified_by integer null, 
created_date date null, 
modified_date date null, 
opis text null, 
gwarancja varchar(64) null, 
vat varchar(16) not null, 
tabela text null, 
PRIMARY KEY(id), UNIQUE(id_tow_ref), 
[b]CONSTRAINT id_tow_referencja FOREIGN KEY (id_tow_ref) REFERENCES kartoteki.towary_dla_zestawy_skladane (id_tow) ON UPDATE CASCADE ON DELETE CASCADE[/b]);

Nie wiem dlaczego to nie działa.]]></description>
			<author><![CDATA[dummy@example.com (rafko)]]></author>
			<pubDate>Fri, 29 Aug 2008 11:52:06 +0000</pubDate>
			<guid>https://forum.postgresql.org.pl/viewtopic.php?pid=267#p267</guid>
		</item>
	</channel>
</rss>
