<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Forum PostgreSQL - update timestamp]]></title>
		<link>https://forum.postgresql.org.pl/viewtopic.php?id=1427</link>
		<description><![CDATA[Najświeższe odpowiedzi w update timestamp.]]></description>
		<lastBuildDate>Wed, 05 Dec 2012 22:42:52 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Odp: update timestamp]]></title>
			<link>https://forum.postgresql.org.pl/viewtopic.php?pid=3832#p3832</link>
			<description><![CDATA[wielkie dzieki za pomoc, własnie o to chodziło...]]></description>
			<author><![CDATA[dummy@example.com (mkarach)]]></author>
			<pubDate>Wed, 05 Dec 2012 22:42:52 +0000</pubDate>
			<guid>https://forum.postgresql.org.pl/viewtopic.php?pid=3832#p3832</guid>
		</item>
		<item>
			<title><![CDATA[Odp: update timestamp]]></title>
			<link>https://forum.postgresql.org.pl/viewtopic.php?pid=3830#p3830</link>
			<description><![CDATA[Jeśli nie zależy Ci na kolejności, a tylko by zmienić pole czas to może wystarczy zrobić tak:

drop sequence lp;
create sequence lp START WITH  1;
update zgloszenie set czas=czas+nextval ('lp') * interval '00:01:00' where opid='6667' and czas='2012-12-31 00:00:00' and pesel<>'0']]></description>
			<author><![CDATA[dummy@example.com (c_michal)]]></author>
			<pubDate>Wed, 05 Dec 2012 14:47:39 +0000</pubDate>
			<guid>https://forum.postgresql.org.pl/viewtopic.php?pid=3830#p3830</guid>
		</item>
		<item>
			<title><![CDATA[Odp: update timestamp]]></title>
			<link>https://forum.postgresql.org.pl/viewtopic.php?pid=3829#p3829</link>
			<description><![CDATA[Jak masz uprawnienia do utworzenia widoku to może zrób 
1. create view v_tabela as select t.id ,czas from zgloszenie t where opid='6667' and czas='2012-12-31 00:00:00' and pesel<>'0' order by czas,id;
2. drop sequence lp;
3. create sequence lp START WITH  1;
4. update z tak zmodyfikowanym selectem
(select t.id ,czas+nextval ('lp') * interval '00:01:00' as nowa_data from v_tabela) t where t.id=d.id ;
5. drop sequence lp;]]></description>
			<author><![CDATA[dummy@example.com (c_michal)]]></author>
			<pubDate>Wed, 05 Dec 2012 13:59:29 +0000</pubDate>
			<guid>https://forum.postgresql.org.pl/viewtopic.php?pid=3829#p3829</guid>
		</item>
		<item>
			<title><![CDATA[Odp: update timestamp]]></title>
			<link>https://forum.postgresql.org.pl/viewtopic.php?pid=3828#p3828</link>
			<description><![CDATA[Moje zapytanie select wyglada tak:

(select t.id ,czas+nextval ('lp') * interval '00:01:00' as nowa_data from
(select t.id ,czas from zgloszenie t order by czas,id) z) t where t.id=d.id and opid='6667' and czas='2012-12-31 00:00:00' and pesel<>'0';


jak je uruchamiam to mam:
LINE 3: ...t.id ,czas from zgloszenie t order by czas,id) z) d where t....
                                                             ^

********** Błąd **********

BŁĄD: błąd składni w lub blisko "d"
Stan SQL: 42601
Znak: 134]]></description>
			<author><![CDATA[dummy@example.com (mkarach)]]></author>
			<pubDate>Wed, 05 Dec 2012 13:49:54 +0000</pubDate>
			<guid>https://forum.postgresql.org.pl/viewtopic.php?pid=3828#p3828</guid>
		</item>
		<item>
			<title><![CDATA[Odp: update timestamp]]></title>
			<link>https://forum.postgresql.org.pl/viewtopic.php?pid=3827#p3827</link>
			<description><![CDATA[a sam select się wykonuje?]]></description>
			<author><![CDATA[dummy@example.com (c_michal)]]></author>
			<pubDate>Wed, 05 Dec 2012 13:46:04 +0000</pubDate>
			<guid>https://forum.postgresql.org.pl/viewtopic.php?pid=3827#p3827</guid>
		</item>
		<item>
			<title><![CDATA[Odp: update timestamp]]></title>
			<link>https://forum.postgresql.org.pl/viewtopic.php?pid=3826#p3826</link>
			<description><![CDATA[Czas chyba na aktualizacje postgresa


teraz mam takie cóś:
BŁĄD:  subquery in FROM cannot refer to other relations of same query level

********** Błąd **********

BŁĄD: subquery in FROM cannot refer to other relations of same query level
Stan SQL: 42P10]]></description>
			<author><![CDATA[dummy@example.com (mkarach)]]></author>
			<pubDate>Wed, 05 Dec 2012 13:42:14 +0000</pubDate>
			<guid>https://forum.postgresql.org.pl/viewtopic.php?pid=3826#p3826</guid>
		</item>
		<item>
			<title><![CDATA[Odp: update timestamp]]></title>
			<link>https://forum.postgresql.org.pl/viewtopic.php?pid=3824#p3824</link>
			<description><![CDATA[no to trzeba wrócić do prehistorii :):):)

wykonaj wszystkie komendy naraz

create sequence lp START WITH  1;
update tabela t set data=d.nowa_data from 
(select id , data+nextval('lp') * interval '00:01:00' as nowa_data from (select t.id ,data from tabela t order by data,id) z) d where t.id=d.id;
drop sequence lp;]]></description>
			<author><![CDATA[dummy@example.com (c_michal)]]></author>
			<pubDate>Wed, 05 Dec 2012 08:07:47 +0000</pubDate>
			<guid>https://forum.postgresql.org.pl/viewtopic.php?pid=3824#p3824</guid>
		</item>
		<item>
			<title><![CDATA[Odp: update timestamp]]></title>
			<link>https://forum.postgresql.org.pl/viewtopic.php?pid=3823#p3823</link>
			<description><![CDATA[mam wersje 8.3.7]]></description>
			<author><![CDATA[dummy@example.com (mkarach)]]></author>
			<pubDate>Tue, 04 Dec 2012 22:07:51 +0000</pubDate>
			<guid>https://forum.postgresql.org.pl/viewtopic.php?pid=3823#p3823</guid>
		</item>
		<item>
			<title><![CDATA[Odp: update timestamp]]></title>
			<link>https://forum.postgresql.org.pl/viewtopic.php?pid=3822#p3822</link>
			<description><![CDATA[Napisz którą wersją postgresql dysponujesz. jeśli masz wyższą niż 8.4 to wszystko powinno być OK.]]></description>
			<author><![CDATA[dummy@example.com (c_michal)]]></author>
			<pubDate>Tue, 04 Dec 2012 22:07:02 +0000</pubDate>
			<guid>https://forum.postgresql.org.pl/viewtopic.php?pid=3822#p3822</guid>
		</item>
		<item>
			<title><![CDATA[Odp: update timestamp]]></title>
			<link>https://forum.postgresql.org.pl/viewtopic.php?pid=3821#p3821</link>
			<description><![CDATA[dostałem błąd:
BŁĄD:  błąd składni w lub blisko "over"
LINE 2: (select t.id ,czas+row_number () over(order by czas,id ) * i...
                                                                 ^

********** Błąd **********]]></description>
			<author><![CDATA[dummy@example.com (mkarach)]]></author>
			<pubDate>Tue, 04 Dec 2012 21:54:53 +0000</pubDate>
			<guid>https://forum.postgresql.org.pl/viewtopic.php?pid=3821#p3821</guid>
		</item>
		<item>
			<title><![CDATA[Odp: update timestamp]]></title>
			<link>https://forum.postgresql.org.pl/viewtopic.php?pid=3819#p3819</link>
			<description><![CDATA[Problem polega na tym, że najpierw musisz ustalić prawidłowa kolejność rekordów. Ja założyłem, że pole timestamp, które nazwałem "data" ma stałą wartość, a kolejność dodawania rekordów wyznacza pole id (im większa liczba w id tym później rekord został dodany). Ale gdyby było inaczej dodałem dodatkowe sortowanie też po polu data w poniższym update (co nic nie zmienia przy moich założeniach)

update tabela t set data=d.nowa_data from 
(select t.id ,data+row_number () over(order by data,id ) * interval '00:01:00' as nowa_data from tabela t) d where t.id=d.id]]></description>
			<author><![CDATA[dummy@example.com (c_michal)]]></author>
			<pubDate>Tue, 04 Dec 2012 20:06:01 +0000</pubDate>
			<guid>https://forum.postgresql.org.pl/viewtopic.php?pid=3819#p3819</guid>
		</item>
		<item>
			<title><![CDATA[update timestamp]]></title>
			<link>https://forum.postgresql.org.pl/viewtopic.php?pid=3818#p3818</link>
			<description><![CDATA[Witam,

proszę o podpowiedź, mam tabele z 1500 rekordów która ma takie kolumny id,imie,nazwisko,pesel,timestamp
np 1, michal,michal,11111000111, 2012-12-30 00:00:00
     2, kasia,kasia, 22222000111,2012-12-30 00:00:00
itd do 1500

chodzi o napisanie query które dodaje minutę do każdego kolejnego rekordu


np 1, michal,michal,11111000111, 2012-12-30 00:01:00
     2, kasia,kasia, 22222000111,2012-12-30 00:02:00
itd do 1500


czy macie jakiś pomysł jak to ugryź?]]></description>
			<author><![CDATA[dummy@example.com (mkarach)]]></author>
			<pubDate>Tue, 04 Dec 2012 14:00:45 +0000</pubDate>
			<guid>https://forum.postgresql.org.pl/viewtopic.php?pid=3818#p3818</guid>
		</item>
	</channel>
</rss>
