<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Daniel Luiz Pakuschewski &#187; Postgres</title>
	<atom:link href="http://www.danielpk.com.br/blog/tag/postgres/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.danielpk.com.br/blog</link>
	<description>Freelancer, Programador, CakePHP, PHP, Wordpress, Drupal, jQuery e amante de tecnologia.</description>
	<lastBuildDate>Sat, 07 Jan 2012 13:45:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Corrigir as sequences do Postgres</title>
		<link>http://www.danielpk.com.br/blog/2010/04/corrigir-as-sequences-do-postgres/</link>
		<comments>http://www.danielpk.com.br/blog/2010/04/corrigir-as-sequences-do-postgres/#comments</comments>
		<pubDate>Thu, 08 Apr 2010 17:39:57 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[Postgres]]></category>
		<category><![CDATA[fix]]></category>
		<category><![CDATA[sequences]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://www.danielpk.com.br/blog/?p=14</guid>
		<description><![CDATA[Função em PLSQL para corrigir as os valores das sequences. CREATE OR REPLACE FUNCTION "public"."fixsequence"() RETURNS "pg_catalog"."int2" AS $BODY$declare v_reg record; v_sql varchar; BEGIN for v_reg in ( select t.table_name ...]]></description>
			<content:encoded><![CDATA[<p>Função em <strong>PLSQL</strong> para corrigir as os valores das sequences.</p>
<pre escaped="true" lang="sql" line="1">
CREATE OR REPLACE FUNCTION "public"."fixsequence"()
  RETURNS "pg_catalog"."int2" AS $BODY$declare v_reg record;
v_sql varchar;
BEGIN
	for v_reg in (
		select t.table_name
		from information_schema.tables t
		where t.table_schema =  'public'
	) loop
  		v_sql := 'SELECT setval(''' || v_reg.table_name || '_id_seq'', (SELECT max(id)+1 FROM ' || v_reg.table_name || '))';
		execute v_sql;
	end loop;
	RETURN 1;
END
$BODY$
  LANGUAGE 'plpgsql' VOLATILE;
</pre>
<p>Furtada descaradamente do <em>Ariel Pat$%&#038;S#</em>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danielpk.com.br/blog/2010/04/corrigir-as-sequences-do-postgres/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

