<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<feed xmlns="http://www.w3.org/2005/Atom">

	<title>Planeta PostgreSQL-es</title>
	<link rel="self" href="http://planeta.postgresql.org.es/atom.xml"/>
	<link href="http://planeta.postgresql.org.es/"/>
	<id>http://planeta.postgresql.org.es/atom.xml</id>
	<updated>2012-05-19T13:30:10+00:00</updated>
	<generator uri="http://www.planetplanet.org/">Planet/2.0 +http://www.planetplanet.org</generator>

	<entry>
		<title type="html">Transacciones autónomas en PostgreSQL</title>
		<link href="http://balteus.blogspot.com/2012/04/transacciones-autonomas-en-postgresql.html"/>
		<id>tag:blogger.com,1999:blog-1763183641342103044.post-1664184788057186202</id>
		<updated>2012-05-18T19:08:33+00:00</updated>
		<content type="html">&lt;div&gt;&lt;div&gt;&lt;a href=&quot;http://1.bp.blogspot.com/-bK-uu771NLk/T3iZaVv2CNI/AAAAAAAABK4/FdyiQQt5fBw/s320/file000515487979.jpg&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;132&quot; src=&quot;http://1.bp.blogspot.com/-bK-uu771NLk/T3iZaVv2CNI/AAAAAAAABK4/FdyiQQt5fBw/s200/file000515487979.jpg&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span&gt;&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span&gt;&lt;i&gt;The cheapest, fastest, and most reliable components are those that aren’t there.&lt;/i&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;right&quot;&gt;&lt;span&gt;Gordon Bell.&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;En algunos casos, necesitamos que ciertas operaciones de una transacción de base de datos sean realizadas aunque la transacción se deshaga con un &lt;i&gt;rollback&lt;/i&gt;. Por ejemplo, imaginemos que tenemos una función o procedimiento almacenado en la que hemos agrupado 10 operaciones. Cuando dicha función se llame, se ejecutará en un contexto transaccional, es decir, se realizará una transacción con dichas 10 operaciones de forma atómica (o todas, o ninguna). Supongamos que queremos garantizar que un subconjunto de esas operaciones (por ejemplo un par de ellas que hacen auditoría de la propia llamada) se realicen siempre, con independencia de las demás: en este caso necesitamos una transacción autónoma.&lt;br /&gt;&lt;br /&gt;Las transacciones autónomas (&lt;i&gt;Autonomous Transactions&lt;/i&gt;) permiten suspender el contexto de la transacción en curso (llamante), realizar una transacción independiente y reanudar el contexto de la transacción llamante sin afectar su estado. Los casos de uso típicos de uso son funcionalidades cuyos cambios queremos que persistan con independencia de la transacción que las llama: trazado (logging), operaciones de auditoría, contadores, funciones de propósito general...etc.&lt;br /&gt;&lt;br /&gt;Un caso que se me ha dado recientemente es el de realizar una transacción batch muy muy larga (de importación de gran cantidad de&amp;nbsp; datos), donde la unidad de importación supone operaciones de modificación (inserción o actualización) en varias tablas. Imaginemos que importamos usuarios con todos sus datos: dirección, provincia, datos bancarios, teléfonos, etc... Cada usuario puede suponer 8 o 10 operaciones en diversas tablas. Si tenemos que importar 30.000 usuarios, podemos encontrarnos con una transacción compuesta por 300.000 operaciones de inserción/actualización. Este tipo de transacciones tan grandes exige muchos recursos de un servidor de base de datos: crea ocupación de memoria y genera muchos puntos de bloqueos que podrían socavar el desempeño de un sistema en producción. Una forma de solucionar un problema así es realizar una confirmación de datos por cada unidad de importación. Es decir, que el bucle general de importación (que ya se ejecuta en un contexto transaccional) llame a una función que realiza y confirma la tarea de importación de una unidad (un usuario en el ejemplo) en una transacción autónoma, con lo cual cada usuario se procesaría de forma atómica, sin que la transacción general acumule trabajo.&lt;br /&gt;&lt;br /&gt;Con Oracle, las transacciones autónomas se declaran sin mayor dificultad usando la directiva:&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush:sql; gutter: false;&quot;&gt;PRAGMA AUTONOMOUS_TRANSACTION;&lt;/pre&gt;&lt;br /&gt;Sin embargo, &lt;b&gt;en PostgreSQL &lt;a href=&quot;http://www.postgresql.org/docs/9.1/static/plpgsql-porting.html#CO.PLPGSQL-PORTING-PRAGMA&quot;&gt;las transacciones autonomas no están soportadas&lt;/a&gt;&lt;/b&gt;. No hay forma de hacerlo de forma declarativa. Sólo hay una forma de hacerlo (con dos enfoques, como veremos enseguida): realizando la parte que queremos que sea &lt;i&gt;autónoma&lt;/i&gt; en otro contexto transaccional, es decir, en otra conexión a la base de datos:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Usando un lenguaje de programación externo (&lt;i&gt;untrusted&lt;/i&gt;).&amp;nbsp; Es decir, reducir la función PL/PgSQL a la parte que queremos garantizar su ejecución (la parte que queremos que sea &lt;i&gt;autónoma&lt;/i&gt;) y realizar el resto en un lenguaje de programación externo a la base de datos. La función se llamará en una nueva conexión&lt;/li&gt;&lt;li&gt;Usando dblink. Esta opción, es parecida a la anterior, pero usando siempre PL/PgSQL. Es decir, realizamos la transacción autónoma en una nueva conexión usando dblink.&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;       dblink&lt;/h2&gt;dblink es un módulo del &lt;i&gt;contrib&lt;/i&gt; de PostgreSQL que permite realizar conexiones y realizar consultas a bases de datos locales o remotas dentro de una sesión. Con un ejemplo se verá más claro:&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush:sql; gutter: false;&quot;&gt;SELECT nombre, apellidos&lt;br /&gt;FROM usuario INNER JOIN&lt;br /&gt;    dblink('dbname=otrabasededatos port=5432 host=localhost_u_otro' ||&lt;br /&gt;           'user=usuario password=password',&lt;br /&gt;           'SELECT direccion, poblacion, provincia from usuario')&lt;br /&gt;            AS u(direccion varchar, poblacion varchar, provincia varchar)&lt;br /&gt;    ON usuario.id = u.id;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;En el anterior ejemplo, realizamos un JOIN entre dos tablas de dos bases de datos distintas (en el mismo host u otro, eso da igual). Es decir, en la sesión en curso, y a través de las funciones de dblink, se crea una conexión sobre la que enviamos nuestra query. Si esto lo hacemos contra el mismo servidor y misma base de datos... &lt;i&gt;voilá&lt;/i&gt;: ya tenemos una conexión nueva y, por tanto, un contexto transaccional diferente en el que podemos ejecutar nuestra transacción de forma independiente (es otra conexión).&lt;br /&gt;&lt;br /&gt;Veamos un ejemplo de cómo usarlo. Supongamos el ejemplo del inicio, donde tenemos un cursor que recorremos en el que, para cada registro, debemos realizar un par de operaciones transaccionales de forma independiente (autónoma). Aprovecharemos el ejemplo también para ilustrar cómo se puede realizar una inserción y obtener la clave del elemento recién insertado para la siguiente sentencia.&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush:sql; gutter: true;&quot;&gt;for usuario in (select * from iusuarios) loop&lt;br /&gt;   raise notice 'Procesando usuario-&amp;gt;, %',usuario.id || '-' || usuario.nombre;&lt;br /&gt;&lt;br /&gt;   PERFORM dblink_connect_u('dbname=dbname connect_timeout=5');&lt;br /&gt;   PERFORM dblink_exec('begin;');&lt;br /&gt;&lt;br /&gt;   l_dbl_sql :=&lt;br /&gt;      'insert into u2 (name,edad) values (' ||&lt;br /&gt;      quote_nullable(l_name) || ', ' ||&lt;br /&gt;      coalesce(l_edad::varchar,'null') || ', ' ||&lt;br /&gt;      '0) returning id;';&lt;br /&gt;   raise notice '[ALTA] SQL INSERT u2: %', l_dbl_sql;&lt;br /&gt;&lt;br /&gt;   select id into l_user_id from dblink(l_dbl_sql) as d(id int4);&lt;br /&gt;&lt;br /&gt;   l_dbl_sql :=&lt;br /&gt;      'update otra_tabla set date = now() where id_user = ' || l_user_id || ';';&lt;br /&gt;   raise notice '[ALTA] SQL UPDATE otra_tabla: %', l_dbl_sql;&lt;br /&gt;   PERFORM dblink_exec(l_dbl_sql);&lt;br /&gt;&lt;br /&gt;   PERFORM dblink_exec('commit;');&lt;br /&gt;   PERFORM dblink_disconnect();&lt;br /&gt;end loop;&lt;/pre&gt;&lt;br /&gt;Examinaremos el ejemplo, porque hay cosas interesantes que quiero destacar: &lt;br /&gt;&lt;ol&gt;&lt;li&gt;Linea 4: es importante especificar el timeout, para evitar &lt;a href=&quot;http://balteus.blogspot.com.es/2011/01/statementtimeout-querytimeout-con.html&quot;&gt;efectos indeseables&lt;/a&gt;. Dado que se trata de la misma base de datos en el mismo servidor, no hay que especificar nada más.&lt;/li&gt;&lt;li&gt;Linea 5: inicio de la transacción, ya que hay más de una sentencia&lt;/li&gt;&lt;li&gt;Líneas 9 y 10: uso de las funciones &lt;span&gt;quote_nullable()&lt;/span&gt; y &lt;span&gt;coalesce()&lt;/span&gt; para garantizar el correcto escape de valores y la generación de 'null' cuando existan valores nulos. &lt;/li&gt;&lt;li&gt;Línea 14: ejemplo de ejecución de sentencia &lt;span&gt;INSERT&lt;/span&gt; con dblink para obtención del registro recién insertado.&lt;/li&gt;&lt;li&gt;Línea 19: ejemplo de ejecución de sentencia &lt;span&gt;UPDATE&lt;/span&gt; (o cualquier otra sentencia que no devuelva resultados)&lt;/li&gt;&lt;li&gt;Línea 21: confirmación de la transacción&lt;/li&gt;&lt;li&gt;Línea 22: desconexión&lt;/li&gt;&lt;li&gt;Líneas 11 y 17: es &lt;b&gt;muy importante&lt;/b&gt; asegurarse de que terminamos las sentencias que enviamos a dblink con el separador de terminación &lt;b&gt;punto y coma (;)&lt;/b&gt;. Un olvido puede hacer que nuestra función se detenga esperando la terminación.&lt;/li&gt;&lt;/ol&gt;Finalmente, recomiendo usar las funciones quote_nullable() para las fechas y cadenas y coalesce() para los valores numéricos para garantizar una correcta sintaxis y escapado de las sentencias. Si estás usando PostgreSQL 9.1 o superior puedes evitar ese engorro y usar la enormemente más cómoda función &lt;a href=&quot;http://www.postgresql.org/docs/9.1/interactive/functions-string.html&quot;&gt;format()&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;b&gt;Referencias y más información:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://www.dosideas.com/wiki/Transacciones_Autonomas_En_Oracle&quot;&gt;Transacciones autónomas en Oracle (de DosIdeas)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.postgresonline.com/journal/archives/44-Using-DbLink-to-access-other-PostgreSQL-Databases-and-Servers.html&quot;&gt;Using DbLink to access other PostgreSQL Databases and Servers&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.postgresql.org/docs/9.1/static/dblink.html&quot;&gt;Documentación de PostgreSQL de dblink&lt;/a&gt; &lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/1763183641342103044-1664184788057186202?l=balteus.blogspot.com&quot; alt=&quot;&quot; /&gt;&lt;/div&gt;</content>
		<author>
			<name>Samuel Zarza Fernández</name>
			<email>noreply@blogger.com</email>
			<uri>http://balteus.blogspot.com/search/label/postgresql</uri>
		</author>
		<source>
			<title type="html">Balteus</title>
			<subtitle type="html">tres estrellas alineadas</subtitle>
			<link rel="self" href="http://balteus.blogspot.com/feeds/posts/default/-/postgresql"/>
			<id>tag:blogger.com,1999:blog-1763183641342103044</id>
			<updated>2012-05-19T06:30:05+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="es">
		<title type="html">Disponible PostgreSQL Magazine #01</title>
		<link href="http://www.postgresql.org.es/node/769"/>
		<id>http://www.postgresql.org.es/769 at http://www.postgresql.org.es</id>
		<updated>2012-05-16T13:14:04+00:00</updated>
		<content type="html">&lt;div class=&quot;image-attach-teaser image-attach-node-257&quot;&gt;&lt;a href=&quot;http://www.postgresql.org.es/node/769&quot;&gt;&lt;img src=&quot;http://www.postgresql.org.es/sites/default/files/images/comunidad.blog.jpg&quot; alt=&quot;comunidad&quot; title=&quot;comunidad&quot; class=&quot;image image-blog &quot; width=&quot;100&quot; height=&quot;96&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;p&gt;Hace unos dias se lanzo el primer número de la revista &quot;PostgreSQL Magazine&quot;. Esta revista es la primera revista sin ánimo de lucro creada por y para la comunidad PostgreSQL.&lt;/p&gt;
&lt;p&gt;Esperan que la gente colabore con artículos, correciones y traducciones. Si estas interesado en el tema pasate por &lt;a href=&quot;http://pgmag.org&quot; title=&quot;http://pgmag.org&quot;&gt;http://pgmag.org&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;El primer número está disponible en estos enlaces:&lt;/p&gt;
&lt;p&gt;Leer online: &lt;a href=&quot;http://pgmag.org/01/read&quot; title=&quot;http://pgmag.org/01/read&quot;&gt;http://pgmag.org/01/read&lt;/a&gt;&lt;br /&gt;
Descargar PDF: &lt;a href=&quot;http://pgmag.org/01/download&quot; title=&quot;http://pgmag.org/01/download&quot;&gt;http://pgmag.org/01/download&lt;/a&gt;&lt;br /&gt;
Comprar la versión impresa: &lt;a href=&quot;http://pgmag.org/01/buy&quot; title=&quot;http://pgmag.org/01/buy&quot;&gt;http://pgmag.org/01/buy&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Que la disfruteis.&lt;br /&gt;
--&lt;br /&gt;
Rafael Martinez Guerrero&lt;br /&gt;
PostgreSQL-es&lt;/p&gt;</content>
		<author>
			<name>Rafael Martinez</name>
			<uri>http://www.postgresql.org.es/rafaelma</uri>
		</author>
		<source>
			<title type="html">rafaelma's blog</title>
			<link rel="self" href="http://www.postgresql.org.es/rafaelma/feed"/>
			<id>http://www.postgresql.org.es/rafaelma/feed</id>
			<updated>2012-05-19T13:30:08+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="es">
		<title type="html">Calentando motores con pgFincore</title>
		<link href="http://www.ecualug.org/2012/03/16/blog/jcasano/calentando_motores_con_pgfincore"/>
		<id>http://www.ecualug.org/16767 at http://www.ecualug.org</id>
		<updated>2012-03-16T06:11:46+00:00</updated>
		<content type="html">&lt;!-- google_ad_section_start --&gt;  &lt;p&gt;Hoy pase toda la mañana ayudando a un cliente con un problema que ya le estaba causando dolores de cabeza. Cada vez que por algún motivo (por ejemplo mantenimiento) debe apagar el servidor al arrancar trabaja desesperantemente lento y tarda casi una hora en empezar a trabajar normalmente.&lt;/p&gt;
  &lt;!-- google_ad_section_end --&gt;&lt;p&gt;&lt;a href=&quot;http://www.ecualug.org/2012/03/16/blog/jcasano/calentando_motores_con_pgfincore&quot; target=&quot;_blank&quot;&gt;leer más&lt;/a&gt;&lt;/p&gt;</content>
		<author>
			<name>Jaime Casanova</name>
			<uri>http://www.ecualug.org/blog/jcasano</uri>
		</author>
		<source>
			<title type="html">jcasano's blog</title>
			<subtitle type="html">¡Te damos la bienvenida a EcuaLUG (&quot;Ecuador GNU/Linux User Group&quot;) es un portal dedicado a difundir el uso e ideales de GNU/Linux® y del Software Libre, proporcionar servicios e información relacionadas a sistemas GNU/Linux® .


No tenemos relación laboral con empresa alguna dedicada a la comercialización de alguna distribución de GNU/Linux®.


¡No olvides registrarte!, como usuario tendrás muchas ventajas y opciones disponibles; como hacer consulta a los usuarios, participar en encuestas, enviar noticias y realizar comentarios, y muchas otras cosas más.


¡Tu opinión sobre el portal es bienvenida para el mejoramiento del mismo!


¡Que lo disfrutes!</subtitle>
			<link rel="self" href="http://www.ecualug.org/blog/1934/feed"/>
			<id>http://www.ecualug.org/blog/1934/feed</id>
			<updated>2012-05-19T13:30:05+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="es">
		<title type="html">Líneas de tiempo del proyecto PostgreSQL y las principales RDBMS</title>
		<link href="http://www.postgresql.org.es/node/729"/>
		<id>http://www.postgresql.org.es/729 at http://www.postgresql.org.es</id>
		<updated>2012-02-29T14:53:45+00:00</updated>
		<content type="html">&lt;div class=&quot;image-attach-teaser image-attach-node-263&quot;&gt;&lt;a href=&quot;http://www.postgresql.org.es/node/729&quot;&gt;&lt;img src=&quot;http://www.postgresql.org.es/sites/default/files/images/documentos.blog.jpg&quot; alt=&quot;documentos&quot; title=&quot;documentos&quot; class=&quot;image image-blog &quot; width=&quot;100&quot; height=&quot;91&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;p&gt;Hace ya un tiempo que empecé a trabajar en dos diagramas con las líneas de tiempo (timeline) del proyecto PostgreSQL y las principales bases de datos relacionales de la historia. Hoy me he decidido a publicarlos para que los interesados en el tema tengan esta información disponible.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.postgresql.org.es/node/729&quot; target=&quot;_blank&quot;&gt;leer más&lt;/a&gt;&lt;/p&gt;</content>
		<author>
			<name>Rafael Martinez</name>
			<uri>http://www.postgresql.org.es/rafaelma</uri>
		</author>
		<source>
			<title type="html">rafaelma's blog</title>
			<link rel="self" href="http://www.postgresql.org.es/rafaelma/feed"/>
			<id>http://www.postgresql.org.es/rafaelma/feed</id>
			<updated>2012-05-19T13:30:08+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="es">
		<title type="html">Nuevas versiones de PostgreSQL disponibles</title>
		<link href="http://www.postgresql.org.es/node/728"/>
		<id>http://www.postgresql.org.es/728 at http://www.postgresql.org.es</id>
		<updated>2012-02-29T08:18:34+00:00</updated>
		<content type="html">&lt;div class=&quot;image-attach-teaser image-attach-node-340&quot;&gt;&lt;a href=&quot;http://www.postgresql.org.es/node/728&quot;&gt;&lt;img src=&quot;http://www.postgresql.org.es/sites/default/files/images/postgres-logo.png&quot; alt=&quot;postgres-logo&quot; title=&quot;postgres-logo&quot; class=&quot;image image-blog &quot; width=&quot;64&quot; height=&quot;64&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;p&gt;El proyecto PostgreSQL ha lanzado nuevas versiones menores de todas las series activas de PostgreSQL. Esta actualización arregla algunos problemas de seguridad. &lt;/p&gt;
&lt;p&gt;Si utilizais pg_dump, certificados SSL y/o triggers que usen SECURITY DEFINER, deberiais de actualizar vuestros sistemas inmediatamente.&lt;/p&gt;
&lt;p&gt;Las nuevas versiones disponibles son 9.1.3, 9.0.7, 8.4.11 y 8.3.18. &lt;/p&gt;
&lt;p&gt;Anuncio oficial de este lanzamiento:&lt;br /&gt;
&lt;a href=&quot;http://www.postgresql.org/about/news/1377/&quot; title=&quot;http://www.postgresql.org/about/news/1377/&quot;&gt;http://www.postgresql.org/about/news/1377/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Más información sobre las versiones lanzadas:&lt;br /&gt;
&lt;a href=&quot;http://www.postgresql.org/docs/current/static/release.html&quot; title=&quot;http://www.postgresql.org/docs/current/static/release.html&quot;&gt;http://www.postgresql.org/docs/current/static/release.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Descargas:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.postgresql.org.es/node/728&quot; target=&quot;_blank&quot;&gt;leer más&lt;/a&gt;&lt;/p&gt;</content>
		<author>
			<name>Rafael Martinez</name>
			<uri>http://www.postgresql.org.es/rafaelma</uri>
		</author>
		<source>
			<title type="html">rafaelma's blog</title>
			<link rel="self" href="http://www.postgresql.org.es/rafaelma/feed"/>
			<id>http://www.postgresql.org.es/rafaelma/feed</id>
			<updated>2012-05-19T13:30:08+00:00</updated>
		</source>
	</entry>

	<entry>
		<title type="html">Orden y formato al código PL/pgSQL</title>
		<link href="http://balteus.blogspot.com/2012/02/orden-y-formato-al-codigo-plpgsql.html"/>
		<id>tag:blogger.com,1999:blog-1763183641342103044.post-1876106362441220573</id>
		<updated>2012-02-28T15:14:39+00:00</updated>
		<content type="html">&lt;div&gt;&lt;div&gt;&lt;a href=&quot;http://1.bp.blogspot.com/-a4Quw_T6jfc/T0Zch46x3tI/AAAAAAAABJg/ywcKAnOgABw/s1600/file2471302811747.jpg&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;150&quot; src=&quot;http://1.bp.blogspot.com/-a4Quw_T6jfc/T0Zch46x3tI/AAAAAAAABJg/ywcKAnOgABw/s200/file2471302811747.jpg&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span&gt;&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span&gt;&lt;i&gt;“Any code of your own that you haven’t looked at for six or more months might as well have been written by someone else.”&lt;/i&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;right&quot;&gt;&lt;span&gt;Eagleson’s Law&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;Leer y entender un trozo de código de unas pocas líneas es fácil, aunque haya sido escrito como si se hubiese caído al suelo y esparcido por toda la habitación. Ahora bien, si tenemos que leer unos cuantos cientos o miles de líneas, la cosa cambia bastante. Es fundamental tener un código ordenado y bien identado para facilitar la legibilidad.&lt;br /&gt;&lt;br /&gt;Existen muchas herramientas que facilitan o realizan directamente esta tarea. Son las llamadas herramientas de embellecimiento o formato (&quot;code beautifiers/formatters tools&quot;). La mayoría de los IDE's y editores tienen herramientas para una gran variedad de lenguajes... salvo para PL, donde me he encontrado bastantes carencias.&lt;br /&gt;&lt;br /&gt;Si necésitáis una herramienta de este estilo, una de las mejores que me he encontrado es &lt;b&gt;&lt;a href=&quot;http://psti.equinoxbase.com/&quot;&gt;Pl/Sql tidy&lt;/a&gt;&lt;/b&gt;. Algunas de sus características son:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Identación por bloques&lt;/li&gt;&lt;li&gt;Compactación&lt;/li&gt;&lt;li&gt;Ajuste de mayúsculas/minusculas&lt;/li&gt;&lt;li&gt;Alineamiento vertical en asignaciones&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;El uso de la herramienta es a través de línea de comando, pero también podéis usar la interesante &lt;a href=&quot;http://psti.equinoxbase.com/cgi-bin/handler.pl&quot;&gt;versión online disponible&lt;/a&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Funciona con PL/pgSQL.&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;b&gt;Referencias y más información:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://psti.equinoxbase.com/&quot;&gt;PL/SQL Tidy&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/1763183641342103044-1876106362441220573?l=balteus.blogspot.com&quot; alt=&quot;&quot; /&gt;&lt;/div&gt;</content>
		<author>
			<name>Samuel Zarza Fernández</name>
			<email>noreply@blogger.com</email>
			<uri>http://balteus.blogspot.com/search/label/postgresql</uri>
		</author>
		<source>
			<title type="html">Balteus</title>
			<subtitle type="html">tres estrellas alineadas</subtitle>
			<link rel="self" href="http://balteus.blogspot.com/feeds/posts/default/-/postgresql"/>
			<id>tag:blogger.com,1999:blog-1763183641342103044</id>
			<updated>2012-05-19T06:30:05+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="es">
		<title type="html">Sobre la integridad del código</title>
		<link href="http://www.ecualug.org/2012/02/23/blog/jcasano/sobre_la_integridad_del_c%C3%B3digo"/>
		<id>http://www.ecualug.org/16711 at http://www.ecualug.org</id>
		<updated>2012-02-24T04:17:30+00:00</updated>
		<content type="html">&lt;!-- google_ad_section_start --&gt;  &lt;p&gt;Acabo de leer un artículo (http://www.techweekeurope.co.uk/news/open-source-code-is-cleaner-than-proprietary-says-coverity-62518) referente a la calidad del código de proyectos open source en comparación con proyectos propietarios (privativos, aunque no es lo mismo propietario es el termino que se uso en el artículo).&lt;/p&gt;
  &lt;!-- google_ad_section_end --&gt;&lt;p&gt;&lt;a href=&quot;http://www.ecualug.org/2012/02/23/blog/jcasano/sobre_la_integridad_del_c%C3%B3digo&quot; target=&quot;_blank&quot;&gt;leer más&lt;/a&gt;&lt;/p&gt;</content>
		<author>
			<name>Jaime Casanova</name>
			<uri>http://www.ecualug.org/blog/jcasano</uri>
		</author>
		<source>
			<title type="html">jcasano's blog</title>
			<subtitle type="html">¡Te damos la bienvenida a EcuaLUG (&quot;Ecuador GNU/Linux User Group&quot;) es un portal dedicado a difundir el uso e ideales de GNU/Linux® y del Software Libre, proporcionar servicios e información relacionadas a sistemas GNU/Linux® .


No tenemos relación laboral con empresa alguna dedicada a la comercialización de alguna distribución de GNU/Linux®.


¡No olvides registrarte!, como usuario tendrás muchas ventajas y opciones disponibles; como hacer consulta a los usuarios, participar en encuestas, enviar noticias y realizar comentarios, y muchas otras cosas más.


¡Tu opinión sobre el portal es bienvenida para el mejoramiento del mismo!


¡Que lo disfrutes!</subtitle>
			<link rel="self" href="http://www.ecualug.org/blog/1934/feed"/>
			<id>http://www.ecualug.org/blog/1934/feed</id>
			<updated>2012-05-19T13:30:05+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="es">
		<title type="html">Logs via SQL/MED</title>
		<link href="http://www.postgresql.org.es/node/715"/>
		<id>http://www.postgresql.org.es/715 at http://www.postgresql.org.es</id>
		<updated>2012-02-04T13:49:33+00:00</updated>
		<content type="html">&lt;div class=&quot;image-attach-teaser image-attach-node-265&quot;&gt;&lt;a href=&quot;http://www.postgresql.org.es/node/715&quot;&gt;&lt;img src=&quot;http://www.postgresql.org.es/sites/default/files/images/idea.blog.jpg&quot; alt=&quot;idea&quot; title=&quot;idea&quot; class=&quot;image image-blog &quot; width=&quot;100&quot; height=&quot;84&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;p&gt;Con la versión 9.1 de PostgreSQL tenemos disponible una nueva funcionalidad llamada SQL/MED mediante la cual se puede acceder a datos externos a nuestra base de datos mediante comandos SQL.&lt;/p&gt;
&lt;p&gt;En SQL/MED existen los llamados &quot;Foreign Data Wrapper (FDW)&quot; que es una especie de &quot;driver&quot; para acceder a un tipo de datos externos. Existen diferentes tipos y con la versión 9.1 existe uno en los modulos &lt;tt&gt;contrib&lt;/tt&gt; que se llama &lt;tt&gt;file_fdw&lt;/tt&gt;. Este FDW se puede utilizar para acceder ficheros en formato CSV.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.postgresql.org.es/node/715&quot; target=&quot;_blank&quot;&gt;leer más&lt;/a&gt;&lt;/p&gt;</content>
		<author>
			<name>Rafael Martinez</name>
			<uri>http://www.postgresql.org.es/rafaelma</uri>
		</author>
		<source>
			<title type="html">rafaelma's blog</title>
			<link rel="self" href="http://www.postgresql.org.es/rafaelma/feed"/>
			<id>http://www.postgresql.org.es/rafaelma/feed</id>
			<updated>2012-05-19T13:30:08+00:00</updated>
		</source>
	</entry>

	<entry>
		<title type="html">DBLink con parametros en PostgreSQL</title>
		<link href="http://sparcki.blogspot.com/2012/01/dblink-con-parametros-en-postgresql.html"/>
		<id>tag:blogger.com,1999:blog-3023674627195806772.post-1464476823955237680</id>
		<updated>2012-01-20T11:35:10+00:00</updated>
		<content type="html">&lt;b&gt;Introducción&lt;/b&gt;&lt;br /&gt;Hace unos días una persona me dejó una duda a modo de comentario en la entrada de &lt;a href=&quot;http://sparcki.blogspot.com/2010/02/dblinks-en-postgresql.html&quot;&gt;DBLinks en PostgreSQL&lt;/a&gt;. Esta duda es sencilla, y, a la vez interesante, por eso, he decidido crear una entrada explicando la solución.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;La duda&lt;/b&gt;&lt;br /&gt;¿Es posible crear una vista en PostgreSQL utilizando un DBLink con parámetros dinámicamente?&lt;br /&gt;&lt;br /&gt;Es decir, lo que queremos es hacer los siguiente:&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;SELECT device_name FROM remote_database_v(param1, param2); &lt;/blockquote&gt;&lt;b&gt;La solución&lt;/b&gt;&lt;br /&gt;Sobre si es posible &lt;b&gt;crear una Vista&lt;/b&gt; con un DBLink parametrizado, lo cierto es que no se puede, es decir, no podemos crear una vista pasando un argumento.&lt;br /&gt;&lt;br /&gt;Sin embargo, podemos &lt;b&gt;crear un procedimiento&lt;/b&gt; que nos devuelva un tipo &quot;record&quot; y pasarle como parámetros la cadena de conexión, por ejemplo:&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;CREATE OR REPLACE FUNCTION test_dblink_with_parameter(dbname character varying, dbhost character varying, dbuser character varying, dbuserpass character varying)&lt;br /&gt;&amp;nbsp; RETURNS SETOF &lt;b&gt;record&lt;/b&gt; AS&lt;br /&gt;$BODY$&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SELECT t.device_name&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM dblink('dbname=' || $1 || '&amp;nbsp; port=5432 host=' || $2 || ' user=' || $3 ||' password=' || $4 , 'SELECT device_name FROM devices.as_device') as &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; t(device_name character varying);&lt;br /&gt;$BODY$&lt;br /&gt;&amp;nbsp; LANGUAGE &lt;b&gt;sql&lt;/b&gt; VOLATILE;&lt;/blockquote&gt;Y ahora podemos llamar a nuestro procedimiento como si fuese una tabla o vista.&lt;br /&gt;&lt;br /&gt;Recordar que al ser de tipo &quot;record&quot; tenemos que decirle cómo es el formato del registro &amp;lt;AS (field1 type, field2 type, fieldn type)&amp;gt;, en nuestor caso devuelve el campo &quot;as_device&quot; que es de type &quot;character varying&quot;.&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;SELECT * FROM test_dblink_with_parameter('dbname','localhost','user','password') AS (device_name character varying);&lt;/blockquote&gt;&lt;b&gt;Algunas Mejoras&lt;/b&gt;&lt;br /&gt;En función de los datos que estamos obteniendo, podemos, por ejemplo, optimizar el coste &amp;lt;COST&amp;gt; y el número de rows &amp;lt;ROWS&amp;gt; del procedimiento. En el ejemplo, hemos dejado el coste y el número de rows &quot;por defecto&quot;,&amp;nbsp; &lt;i&gt;COST 100&lt;/i&gt; y&amp;nbsp; &lt;i&gt;ROWS 100&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Referencias&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://sparcki.blogspot.com/2010/09/instalacion-de-postgresql-en.html&quot;&gt;Instalación de PostgreSQL 9.0 en OpenIndiana &lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://sparcki.blogspot.com/2009/10/instalar-postgresql-en-solaris-10-parte.html&quot;&gt;Instalación de PostgreSQL en Solaris 10&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://sparcki.blogspot.com/2010/11/copias-de-seguridad-y-recuperacion-en.html&quot;&gt;Copias de Seguridad en PostgreSQL&amp;nbsp;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://blog.sfchildren.com/blogger/postgres/9.0.3/openindiana/postgresql-9.0.3-x86-64bit-openindiana-with-uuid.tar.gz&quot;&gt;PostgreSQL 9.0.3 x86 64bit para OpenIndiana con UUID&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://sparcki.blogspot.com/2011/03/compilar-ossp-uuid-en-openindiana-para.html&quot;&gt;Instalación de OSSP UUID en OpenIndiana &lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/3023674627195806772-1464476823955237680?l=sparcki.blogspot.com&quot; alt=&quot;&quot; /&gt;&lt;/div&gt;</content>
		<author>
			<name>Urko Benito</name>
			<email>noreply@blogger.com</email>
			<uri>http://sparcki.blogspot.com/search/label/postgres</uri>
		</author>
		<source>
			<title type="html">Solaris Black Box :: El Blog en Castellano</title>
			<subtitle type="html">Blog donde comento mis historias con el sistema operativo Sun Solaris durante todos estos años de lucha y placer.</subtitle>
			<link rel="self" href="http://sparcki.blogspot.com/feeds/posts/default/-/postgres"/>
			<id>tag:blogger.com,1999:blog-3023674627195806772</id>
			<updated>2012-05-19T06:30:10+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Create ISO image from USB/Pendrive or any directory || Crear una imagen ISO desde un Pendrive o cualquier directorio</title>
		<link href="http://blog.santiago.zarate.net.ve/2012/01/create-iso-image-from-usbpendrive-or-any-directory-crear-una-imagen-iso-desde-un-pendrive-o-cualquier-directorio"/>
		<id>http://blog.santiago.zarate.net.ve/?p=234</id>
		<updated>2012-01-12T12:52:56+00:00</updated>
		<content type="html">&lt;p&gt;If you ever have the need to create a ISO image from a Pendrive/USB disk or a directory, this line might save your life.&lt;/p&gt;
&lt;p&gt;Si en algun momento te has visto en la necesidad de crear una imagen ISO de un pendrive, disco usb o un directorio en particular esta linea podria salvar tu vida:&lt;/p&gt;
&lt;pre class=&quot;brush: bash; title: ; notranslate&quot;&gt;mkisofs -o name-of-your-image.iso /path/to/directory &lt;/pre&gt;
&lt;p&gt;And that&amp;#8217;s it, no sudo, no dd, no need to use more space than needed (a problem i found using DD)&lt;br /&gt;
Y eso es todo, sin sudo, sin dd, sin necesidad de usar mas espacio del requerido (un problema que encontre cuando trate de usar dd)&lt;/p&gt;
&lt;p&gt;note: add &lt;b&gt;-J&lt;/b&gt; if you&amp;#8217;re planning to use that iso on windows&lt;br /&gt;
nota: agrega &lt;b&gt;-J&lt;/b&gt; si vas a utilizar esa ISO en windows&lt;/p&gt;</content>
		<author>
			<name>Santiago Zararte</name>
			<uri>http://blog.santiago.zarate.net.ve</uri>
		</author>
		<source>
			<title type="html">Agras Zeta Atino</title>
			<subtitle type="html">Un blog mas de tecnologia, locuras y procrastinacion</subtitle>
			<link rel="self" href="http://blog.santiago.zarate.net.ve/feeds/categories/bases-de-datos/feed"/>
			<id>http://blog.santiago.zarate.net.ve/feeds/categories/bases-de-datos/feed</id>
			<updated>2012-02-27T07:30:07+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Git repository from scratch | Creando un repositorio GIT desde cero</title>
		<link href="http://blog.santiago.zarate.net.ve/2011/12/git-repository-from-scratch-creando-un-repositorio-git-desde-cero"/>
		<id>http://blog.santiago.zarate.net.ve/?p=215</id>
		<updated>2011-12-28T07:53:32+00:00</updated>
		<content type="html">&lt;p&gt;&lt;del datetime=&quot;2011-12-28T07:40:51+00:00&quot;&gt;Just go to the end of the post if you dont wanna read all of it&lt;/del&gt;&lt;br /&gt;
So you&amp;#8217;ve been playing with git, and you&amp;#8217;ve already done the common thing:&lt;/p&gt;
&lt;pre class=&quot;brush: bash; title: ; notranslate&quot;&gt;
$ git init
$ git add .
$ git commit
&lt;/pre&gt;
&lt;p&gt;And then, you decide to upload your code somewhere else than github, gitorius or anywhat lets you use git (and where the workflow is: first create the repo, clone, then develop). That&amp;#8217;s when you meet it, the hell&amp;#8230; Its very annoying specially when you just want quick development, and what you really need is to start something, after you finish you decide to track the code, and then you see yourself in something like this:&lt;/p&gt;
&lt;pre class=&quot;brush: bash; title: ; notranslate&quot;&gt;
$ mkdir ../myproject-new
$ cd ../myproject-new
$ git init
$ mv ../myproject/* .
$ git add .
$ git commit
&lt;/pre&gt;
&lt;p&gt;And then, you meet the unconfortable truth, you dont have a bare rep to push your changes&amp;#8230; so you kind of start over, to create a new repo so you can clone from it (although its empty) then add your files, commit and push&amp;#8230; An easy way to do this would be like this:&lt;/p&gt;
&lt;p&gt;Say you have a local branch, no other locations to pull from or to push to, your only working copy, and want to upload somewhere&amp;#8230; before going into the git init|add|commit|clone|add origin hell just do this within your working copy:&lt;/p&gt;
&lt;pre class=&quot;brush: bash; title: ; notranslate&quot;&gt;git clone --bare $(pwd) git://server.com/path.git&lt;/pre&gt;
&lt;p&gt;And that&amp;#8217;s it, this will create a new bare directory under the the path you specified&amp;#8230; with no additional setup, and no madness. So you can ask your team members to just clone from server.com/path.git and that&amp;#8217;s it&amp;#8230; Painless&lt;/p&gt;</content>
		<author>
			<name>Santiago Zararte</name>
			<uri>http://blog.santiago.zarate.net.ve</uri>
		</author>
		<source>
			<title type="html">Agras Zeta Atino</title>
			<subtitle type="html">Un blog mas de tecnologia, locuras y procrastinacion</subtitle>
			<link rel="self" href="http://blog.santiago.zarate.net.ve/feeds/categories/bases-de-datos/feed"/>
			<id>http://blog.santiago.zarate.net.ve/feeds/categories/bases-de-datos/feed</id>
			<updated>2012-02-27T07:30:07+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">MD5 easily from shell with Perl  | MD5 Facil desde la consola con Perl</title>
		<link href="http://blog.santiago.zarate.net.ve/2011/12/md5-easily-from-shell-with-perl-md5-facil-desde-la-consola-con-perl"/>
		<id>http://blog.santiago.zarate.net.ve/?p=211</id>
		<updated>2011-12-28T07:35:29+00:00</updated>
		<content type="html">&lt;p&gt;Recently i found myself having to generate a md5 hash to specific lines in a file&amp;#8230; after googling a while (being addicted to automation more than repeating myself) i came with this simple solution in perl:&lt;/p&gt;
&lt;div id=&quot;gist-1526983&quot; class=&quot;gist&quot;&gt;

        &lt;div class=&quot;gist-file&quot;&gt;
          &lt;div class=&quot;gist-data gist-syntax&quot;&gt;
              &lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;div class=&quot;line&quot; id=&quot;LC1&quot;&gt;perl -M&lt;span class=&quot;s1&quot;&gt;'Digest::MD5 qw(md5_hex)'&lt;/span&gt; -e &lt;span class=&quot;s1&quot;&gt;'print md5_hex(&amp;quot;`date +%d%m%y`&amp;quot;)'&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;
          &lt;/div&gt;

          &lt;div class=&quot;gist-meta&quot;&gt;
            &lt;a href=&quot;https://gist.github.com/raw/1526983/7050384258e7945165b7889db9b943e19e1ad717/md5.sh&quot;&gt;view raw&lt;/a&gt;
            &lt;a href=&quot;https://gist.github.com/1526983#file_md5.sh&quot;&gt;md5.sh&lt;/a&gt;
            &lt;a href=&quot;https://gist.github.com/1526983&quot;&gt;This Gist&lt;/a&gt; brought to you by &lt;a href=&quot;http://github.com&quot;&gt;GitHub&lt;/a&gt;.
          &lt;/div&gt;
        &lt;/div&gt;
&lt;/div&gt;</content>
		<author>
			<name>Santiago Zararte</name>
			<uri>http://blog.santiago.zarate.net.ve</uri>
		</author>
		<source>
			<title type="html">Agras Zeta Atino</title>
			<subtitle type="html">Un blog mas de tecnologia, locuras y procrastinacion</subtitle>
			<link rel="self" href="http://blog.santiago.zarate.net.ve/feeds/categories/bases-de-datos/feed"/>
			<id>http://blog.santiago.zarate.net.ve/feeds/categories/bases-de-datos/feed</id>
			<updated>2012-02-27T07:30:07+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Pretty Print JSON | Mostrando cadenas en JSON Legibles</title>
		<link href="http://blog.santiago.zarate.net.ve/2011/12/pretty-print-json-mostrando-cadenas-en-json-legibles"/>
		<id>http://beta.proyectos.zarate.net.ve/?p=3</id>
		<updated>2011-12-28T07:24:15+00:00</updated>
		<content type="html">&lt;p&gt;This is a post of the series: &lt;a title=&quot;How I Series&quot; href=&quot;http://blog.santiago.zarate.net.ve/category/how-i&quot; target=&quot;_blank&quot;&gt;How I&lt;/a&gt;.&lt;br /&gt;
Este es un post simple en la serie &amp;#8220;&lt;a title=&quot;Como Yo&quot; href=&quot;http://blog.santiago.zarate.net.ve/category/how-i&quot; target=&quot;_blank&quot;&gt;Como yo&lt;/a&gt;&amp;#8220;.&lt;/p&gt;
&lt;p&gt;The idea for now is to show &lt;a title=&quot;JavaScript Object Notation&quot; href=&quot;http://es.wikipedia.org/wiki/JSON&quot; target=&quot;_blank&quot;&gt;JSON&lt;/a&gt; strings in a fashion way so that we can read complex &lt;a title=&quot;JavaScript Object Notation&quot; href=&quot;http://es.wikipedia.org/wiki/JSON&quot; target=&quot;_blank&quot;&gt;JSON&lt;/a&gt; strings easier, ill show some ways, its up to you which one to use.&lt;/p&gt;
&lt;p&gt;La idea es poder ver cadenas &lt;a title=&quot;JavaScript Object Notation&quot; href=&quot;http://es.wikipedia.org/wiki/JSON&quot; target=&quot;_blank&quot;&gt;JSON&lt;/a&gt; en una forma bonita y sencilla de leer complejas cadenas &lt;a title=&quot;JavaScript Object Notation&quot; href=&quot;http://es.wikipedia.org/wiki/JSON&quot; target=&quot;_blank&quot;&gt;JSON&lt;/a&gt;, de una forma realmente sencilla. Mostrare algunas formas, tu decides cual te conviene.&lt;/p&gt;
&lt;p&gt;Python:&lt;/p&gt;
&lt;pre class=&quot;brush: bash; title: ; notranslate&quot;&gt;cat file.json | python -mjson.tool&lt;/pre&gt;
&lt;p&gt;Perl:&lt;/p&gt;
&lt;pre class=&quot;brush: bash; title: ; notranslate&quot;&gt;cat file.json | perl jsonpp.pl&lt;/pre&gt;
&lt;div id=&quot;gist-807220&quot; class=&quot;gist&quot;&gt;

        &lt;div class=&quot;gist-file&quot;&gt;
          &lt;div class=&quot;gist-data gist-syntax&quot;&gt;
              &lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;div class=&quot;line&quot; id=&quot;LC1&quot;&gt;&lt;span class=&quot;c1&quot;&gt;#!/usr/bin/env perl&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line&quot; id=&quot;LC2&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;line&quot; id=&quot;LC3&quot;&gt;&lt;span class=&quot;k&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;JSON&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line&quot; id=&quot;LC4&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;line&quot; id=&quot;LC5&quot;&gt;&lt;span class=&quot;k&quot;&gt;my&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$json&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;JSON&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line&quot; id=&quot;LC6&quot;&gt;&lt;span class=&quot;nb&quot;&gt;undef&lt;/span&gt; &lt;span class=&quot;vg&quot;&gt;$/&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line&quot; id=&quot;LC7&quot;&gt;&lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line&quot; id=&quot;LC8&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class=&quot;k&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$json&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pretty&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;encode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$json&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;decode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$_&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line&quot; id=&quot;LC9&quot;&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;
          &lt;/div&gt;

          &lt;div class=&quot;gist-meta&quot;&gt;
            &lt;a href=&quot;https://gist.github.com/raw/807220/7d76665e653f66b3f3c87ba289dd6ca57a991d04/jsonpp.pl&quot;&gt;view raw&lt;/a&gt;
            &lt;a href=&quot;https://gist.github.com/807220#file_jsonpp.pl&quot;&gt;jsonpp.pl&lt;/a&gt;
            &lt;a href=&quot;https://gist.github.com/807220&quot;&gt;This Gist&lt;/a&gt; brought to you by &lt;a href=&quot;http://github.com&quot;&gt;GitHub&lt;/a&gt;.
          &lt;/div&gt;
        &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;ps: Most of the info comes from a post at &lt;a href=&quot;http://blog.endpoint.com/2011/02/json-pretty-printer.html&quot;&gt;endpoint&amp;#8217;s blog&lt;/a&gt;&lt;/p&gt;</content>
		<author>
			<name>Santiago Zararte</name>
			<uri>http://blog.santiago.zarate.net.ve</uri>
		</author>
		<source>
			<title type="html">Agras Zeta Atino</title>
			<subtitle type="html">Un blog mas de tecnologia, locuras y procrastinacion</subtitle>
			<link rel="self" href="http://blog.santiago.zarate.net.ve/feeds/categories/bases-de-datos/feed"/>
			<id>http://blog.santiago.zarate.net.ve/feeds/categories/bases-de-datos/feed</id>
			<updated>2012-02-27T07:30:07+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="es">
		<title type="html">Creando 30.000 tablas con PostgreSQL</title>
		<link href="http://www.postgresql.org.es/node/692"/>
		<id>http://www.postgresql.org.es/692 at http://www.postgresql.org.es</id>
		<updated>2011-12-23T14:15:19+00:00</updated>
		<content type="html">&lt;div class=&quot;image-attach-teaser image-attach-node-258&quot;&gt;&lt;a href=&quot;http://www.postgresql.org.es/node/692&quot;&gt;&lt;img src=&quot;http://www.postgresql.org.es/sites/default/files/images/cpu.blog.gif&quot; alt=&quot;cpu&quot; title=&quot;cpu&quot; class=&quot;image image-blog &quot; width=&quot;100&quot; height=&quot;90&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;p&gt;Esta mañana leyendo los mensajes de Twitter que me llegaron por la noche, me encontre con uno que me llamó la atención, &lt;a href=&quot;http://www.mysqlperformanceblog.com/2011/12/22/optimizing-innodb-for-creating-30000-tables-and-nothing-else/&quot;&gt;&lt;i&gt;&quot;Steward Smith blogs on Optimazing InnoDB for creating 30.000 tables (and nothing else)&quot;&lt;/i&gt;&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;
Empece a leerlo y estuvo entretenido. Trataba de lo que se podia hacer para acelerar la creación de muchos objetos en MySQL usando InnoDB, esto es especialmente importante cuando se vaya a importar una nueva base de datos que sea grande. &lt;/p&gt;
&lt;p&gt;&lt;p&gt;&lt;a href=&quot;http://www.postgresql.org.es/node/692&quot; target=&quot;_blank&quot;&gt;leer más&lt;/a&gt;&lt;/p&gt;&lt;/p&gt;</content>
		<author>
			<name>Rafael Martinez</name>
			<uri>http://www.postgresql.org.es/rafaelma</uri>
		</author>
		<source>
			<title type="html">rafaelma's blog</title>
			<link rel="self" href="http://www.postgresql.org.es/rafaelma/feed"/>
			<id>http://www.postgresql.org.es/rafaelma/feed</id>
			<updated>2012-05-19T13:30:08+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="es">
		<title type="html">Nuevas versiones de PostgreSQL disponibles</title>
		<link href="http://www.postgresql.org.es/node/688"/>
		<id>http://www.postgresql.org.es/688 at http://www.postgresql.org.es</id>
		<updated>2011-12-06T12:33:37+00:00</updated>
		<content type="html">&lt;div class=&quot;image-attach-teaser image-attach-node-340&quot;&gt;&lt;a href=&quot;http://www.postgresql.org.es/node/688&quot;&gt;&lt;img src=&quot;http://www.postgresql.org.es/sites/default/files/images/postgres-logo.png&quot; alt=&quot;postgres-logo&quot; title=&quot;postgres-logo&quot; class=&quot;image image-blog &quot; width=&quot;64&quot; height=&quot;64&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;p&gt;El proyecto PostgreSQL ha lanzado nuevas versiones menores de todas las series activas de PostgreSQL. Las nuevas versiones disponibles son 9.1.2, 9.0.6, 8.4.10, 8.3.17 y 8.2.23. Recordamos que la serie 8.2 no se actualizará más y la versión 8.2.23 es la última versión de esta serie.&lt;/p&gt;
&lt;p&gt;Anuncio oficial de este lanzamiento:&lt;br /&gt;
&lt;a href=&quot;http://www.postgresql.org/about/news/1366/&quot; title=&quot;http://www.postgresql.org/about/news/1366/&quot;&gt;http://www.postgresql.org/about/news/1366/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Más información sobre las versiones lanzadas:&lt;br /&gt;
&lt;a href=&quot;http://www.postgresql.org/docs/current/static/release.html&quot; title=&quot;http://www.postgresql.org/docs/current/static/release.html&quot;&gt;http://www.postgresql.org/docs/current/static/release.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Descargas:&lt;br /&gt;
&lt;a href=&quot;http://www.postgresql.org/download/&quot; title=&quot;http://www.postgresql.org/download/&quot;&gt;http://www.postgresql.org/download/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Código fuente:&lt;br /&gt;
&lt;a href=&quot;http://www.postgresql.org/ftp/source/&quot; title=&quot;http://www.postgresql.org/ftp/source/&quot;&gt;http://www.postgresql.org/ftp/source/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.postgresql.org.es/node/688&quot; target=&quot;_blank&quot;&gt;leer más&lt;/a&gt;&lt;/p&gt;</content>
		<author>
			<name>Rafael Martinez</name>
			<uri>http://www.postgresql.org.es/rafaelma</uri>
		</author>
		<source>
			<title type="html">rafaelma's blog</title>
			<link rel="self" href="http://www.postgresql.org.es/rafaelma/feed"/>
			<id>http://www.postgresql.org.es/rafaelma/feed</id>
			<updated>2012-05-19T13:30:08+00:00</updated>
		</source>
	</entry>

	<entry>
		<title type="html">Los niveles de aislamiento en PostgreSQL (no son 4)</title>
		<link href="http://balteus.blogspot.com/2011/11/los-niveles-de-aislamiento-en.html"/>
		<id>tag:blogger.com,1999:blog-1763183641342103044.post-221255291762211172</id>
		<updated>2011-11-14T00:17:37+00:00</updated>
		<content type="html">&lt;br /&gt;&lt;div&gt;&lt;div&gt;&lt;a href=&quot;http://4.bp.blogspot.com/-2pveBRJhPus/Tr0AjeZqh0I/AAAAAAAABFY/IXlFOXLXXmA/s200/n%25C3%25BAmeros.png&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;133&quot; src=&quot;http://4.bp.blogspot.com/-2pveBRJhPus/Tr0AjeZqh0I/AAAAAAAABFY/IXlFOXLXXmA/s200/n%25C3%25BAmeros.png&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span&gt;&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span&gt;&lt;i&gt;&quot;No. No lo intentes. Hazlo, o no lo hagas, pero no lo intentes.&quot;&lt;/i&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;div align=&quot;right&quot;&gt;- &lt;span&gt;&lt;a href=&quot;http://es.wikipedia.org/wiki/Yoda&quot;&gt;Maestro Yoda&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;Cuando ví el Episodio IV de la Guerra de las Galaxias (&quot;El Imperio Contraataca&quot;), aún era un niño impresionable, y me llamó la atención la reprenda que hizo Yoda a Luke y que cito aquí. Era uno de ésos consejos marciales que se enuncian solemnes como un consejo vital.&lt;br /&gt;&lt;br /&gt;Con el tiempo te das cuenta que como consejo está bien, y puede ser incluso un buen objetivo... pero en ciertas facetas de la vida no es válido. Por ejemplo, en el mundo científico y en nuestro mundo profesional el consejo es justamente el contrario: inténtalo, pruébalo y compruébalo. Y sólo cuando lo hayas hecho y consigas un resultado repetible, ponlo en práctica, esto es, &lt;i&gt;súbelo a producción&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;Gracias a no seguir el consejo de Yoda fui consciente de una (grave) carencia de PostgreSQL con respecto a los niveles de aislamiento. Como &lt;a href=&quot;http://balteus.blogspot.com/2010/10/control-del-nivel-de-aislamiento.html&quot;&gt;ya hice una introducción al aislamiento en otro artículo&lt;/a&gt;, no voy a extenderme más en el tema y voy al grano. El caso que me ocupaba es que tenía que hacer una importación transaccional de datos masiva en un sistema en OLTP de producción en el que se están modificando constantemente datos relacionados con los que voy a importar. El resultado de la importación es que la transacción gigante bloquea datos e impide que se efectúen modificaciones en datos relacionados paralizando en la práctica buena parte de las operaciones de producción produciéndose un efecto &quot;bola de nieve&quot; al sumarse cada vez más transacciones en cola a la transacción gigante pendiente. Sin embargo, para lo único que quiero la transacción es para tener atomicidad en la operación, es decir, para que no se quede a medias en caso de algún problema, pero no me importa que se puedan producir eventualmente casos de &lt;i&gt;dirty read&lt;/i&gt;, que no afectarían a los usuarios del sistema de producción en su trabajo. Vale, no hay problema. La transacción de inserción la podemos realizar con el nivel de aislamiento más bajo (READ_UNCOMMITED) y problema solucionado. ¿No? No obstante, no hagamos caso a Yoda, y probémoslo en pre-producción. Resultado: exactamente el mismo que si no hubiera especificado nada del nivel de aislamiento.&lt;br /&gt;&lt;br /&gt;¿Qué ha pasado? &lt;br /&gt;&lt;br /&gt;En la &lt;a href=&quot;http://www.postgresql.org/docs/9.0/static/sql-set-transaction.html&quot;&gt;documentación de SET TRANSACTION&lt;/a&gt;, en efecto compruebo que PostgreSQL admite los cuatro niveles de aislamiento como la mayoría de las bases de datos (de hecho, la sentencia no dio error)... pero sólo sintácticamente: no están todos implementados. Si contiúas leyendo te das cuenta que no son 4, sino 2 los niveles implementados:&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&quot;The SQL standard defines two additional levels, &lt;tt class=&quot;LITERAL&quot;&gt;READ    UNCOMMITTED&lt;/tt&gt; and &lt;tt class=&quot;LITERAL&quot;&gt;REPEATABLE READ&lt;/tt&gt;.    In &lt;span class=&quot;PRODUCTNAME&quot;&gt;PostgreSQL&lt;/span&gt; &lt;tt class=&quot;LITERAL&quot;&gt;READ    UNCOMMITTED&lt;/tt&gt; is treated as    &lt;tt class=&quot;LITERAL&quot;&gt;READ COMMITTED&lt;/tt&gt;, while &lt;tt class=&quot;LITERAL&quot;&gt;REPEATABLE    READ&lt;/tt&gt; is treated as &lt;tt class=&quot;LITERAL&quot;&gt;SERIALIZABLE&lt;/tt&gt;.&quot;&lt;/blockquote&gt;Lo que viene a decir: &quot;&lt;i&gt;¿Pensabas que eran cuatro, no? Pues no. Son dos&lt;/i&gt;&quot;. De hecho, ahora (con la versión 9.1) ya son 3. Pero sigue sin estar soportada la &lt;i&gt;lectura sucia&lt;/i&gt; (&lt;i&gt;dirty read&lt;/i&gt;). En la &lt;a href=&quot;http://www.postgresql.org/docs/9.0/static/transaction-iso.html&quot;&gt;documentación sobre aislamiento&lt;/a&gt; también es bastante claro:&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&quot;In &lt;span class=&quot;PRODUCTNAME&quot;&gt;PostgreSQL&lt;/span&gt;, you can request any of  the     four standard transaction isolation levels.  But internally,&lt;b&gt;  there are     only two distinct isolation levels&lt;/b&gt;, which correspond to  the levels Read     Committed and Serializable.  When you select the  level Read     Uncommitted you really get Read Committed, and when you  select     Repeatable Read you really get Serializable, so the actual      isolation level might be stricter than what you select.&quot;&lt;/blockquote&gt;&lt;br /&gt;Un verdadero jarro de agua a mis pretensiones, ya que no puedo conseguir atomicidad sin bloqueo (aunque sea realizando lecturas de transacciones no confirmadas) en PostgreSQL, al menos con la versión actual 9.1.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;b&gt;Referencias y más información:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://www.postgresql.org/docs/9.0/static/transaction-iso.html&quot;&gt;Transaction Isolation (Documentación de PostgreSQL 9.0) (2 Niveles)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.postgresql.org/docs/9.0/static/sql-set-transaction.html&quot;&gt;SET TRANSACTION (Documentación de PostgreSQL 9.0) (2 Niveles)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.postgresql.org/docs/9.1/static/transaction-iso.html&quot;&gt;Transaction Isolation (Documentación de PostgreSQL 9.1) (3 Niveles)&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.postgresql.org/docs/9.1/static/sql-set-transaction.html&quot;&gt;SET TRANSACTION (Documentación de PostgreSQL 9.1) (3 Niveles)&lt;/a&gt; &lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;ul&gt;&lt;/ul&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/1763183641342103044-221255291762211172?l=balteus.blogspot.com&quot; alt=&quot;&quot; /&gt;&lt;/div&gt;</content>
		<author>
			<name>Samuel Zarza Fernández</name>
			<email>noreply@blogger.com</email>
			<uri>http://balteus.blogspot.com/search/label/postgresql</uri>
		</author>
		<source>
			<title type="html">Balteus</title>
			<subtitle type="html">tres estrellas alineadas</subtitle>
			<link rel="self" href="http://balteus.blogspot.com/feeds/posts/default/-/postgresql"/>
			<id>tag:blogger.com,1999:blog-1763183641342103044</id>
			<updated>2012-05-19T06:30:05+00:00</updated>
		</source>
	</entry>

	<entry>
		<title type="html">Alternativas EAV con XML (en PostgreSQL 8.3)</title>
		<link href="http://balteus.blogspot.com/2009/05/alternativas-eav-con-xml-en-postgresql.html"/>
		<id>tag:blogger.com,1999:blog-1763183641342103044.post-4151667638100525658</id>
		<updated>2011-11-01T21:14:15+00:00</updated>
		<content type="html">&lt;b&gt;El modelo EAV&lt;/b&gt;&lt;br /&gt;El modelo &lt;i&gt;Entidad-Atributo-Valor&lt;/i&gt; (&lt;a href=&quot;http://en.wikipedia.org/wiki/Entity-Attribute-Value_model&quot;&gt;EAV&lt;/a&gt;, Entity-Attribute-Value), también conocido como &lt;i&gt;Objeto-Atributo-Valor&lt;/i&gt; o Esquema Abierto, se usa en casos donde el número de atributos (propiedades, parámetros) usados para describir una entidad u objeto es potencialmente grande, pero que aplicados individualmente a una entidad concreta es pequeño. Las circunstancias donde se suelen aplicar son: &lt;br /&gt;&lt;ul&gt;&lt;li&gt;Entidades con atributos heterogéneos:&lt;br /&gt;&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Entidades dinámicas en el tiempo, donde los atributos de una entidad son fijos, pero durante un período de tiempo variable. Es decir, son cambiantes (pueden crecer o decrecer) en el tiempo.&lt;/li&gt;&lt;li&gt;Entidades conceptualmente dinámicas, dependiendo de la interpretación del sistema en un determinado momento. Es decir, entidades cuyo número de atributos cambia según el contexto (p.e.: atributos definidos por el usuario) &lt;/li&gt;&lt;/ul&gt;&lt;li&gt;Entidades con atributos homogéneos &lt;a href=&quot;http://en.wikipedia.org/wiki/Sparse_matrix&quot;&gt;muy poco densos&lt;/a&gt;. Es decir, entidades con una desproporción muy grande entre el número de atributos posibles y el número de atributos con valor (no nulos).&lt;/li&gt;&lt;/ul&gt;Entidades en escenarios típicos de este tipo de modelos son, por ejemplo: &lt;br /&gt;&lt;ul&gt;&lt;li&gt;documentos (en una base de datos documental) cuyos atributos asignados a cada documento depende de la empresa, departamento, tipo de documento, etc...&lt;/li&gt;&lt;li&gt;información cuya catalogación adicional depende de parámetros definidos por el usuario&lt;/li&gt;&lt;li&gt;conceptos de negocio o abstractos cuyos atributos dependen de varios factores y varían en el tiempo: &lt;i&gt;&quot;expediente&quot;&lt;/i&gt;, &lt;i&gt;&quot;valoración&quot;&lt;/i&gt;, &lt;i&gt;&quot;indicencia&quot;&lt;/i&gt;, etc...&lt;/li&gt;&lt;/ul&gt;Este modelo se suele resolver sobre el modelo relacional con tres tablas: la de entidad, la de atributos posibles de dicha entidad y la de valores. La información se registra conceptualmente en la tabla de valores, que relaciona la información a través de tres columnas: clave ajena de entidad, clave ajena de atributo y valor.&lt;br /&gt;&lt;br /&gt;&lt;table border=&quot;0&quot; cellpadding=&quot;2&quot; cellspacing=&quot;2&quot;&gt;  &lt;tbody&gt;&lt;tr valign=&quot;top&quot;&gt;      &lt;td&gt;&lt;table border=&quot;1&quot; cellpadding=&quot;4&quot; cellspacing=&quot;0&quot; height=&quot;107&quot;&gt;        &lt;colgroup&gt;&lt;col width=&quot;19&quot; /&gt; &lt;col width=&quot;135&quot; /&gt; &lt;/colgroup&gt;&lt;tbody&gt;&lt;tr valign=&quot;top&quot;&gt;            &lt;td colspan=&quot;2&quot; valign=&quot;top&quot; width=&quot;162&quot;&gt;&lt;span&gt;&lt;b&gt;Incidencia&lt;/b&gt;&lt;/span&gt;            &lt;/td&gt;          &lt;/tr&gt;&lt;tr valign=&quot;top&quot;&gt;            &lt;td width=&quot;19&quot;&gt;&lt;span&gt;&lt;b&gt;Id&lt;/b&gt;&lt;/span&gt;            &lt;/td&gt;            &lt;td width=&quot;135&quot;&gt;&lt;span&gt;&lt;b&gt;Fecha&lt;/b&gt;&lt;/span&gt;            &lt;/td&gt;          &lt;/tr&gt;&lt;tr valign=&quot;top&quot;&gt;            &lt;td width=&quot;19&quot;&gt;&lt;i&gt;1&lt;/i&gt;            &lt;/td&gt;            &lt;td width=&quot;135&quot;&gt;17/05/19 22:10             &lt;/td&gt;          &lt;/tr&gt;&lt;tr valign=&quot;top&quot;&gt;            &lt;td width=&quot;19&quot;&gt;&lt;i&gt;2&lt;/i&gt;            &lt;/td&gt;            &lt;td width=&quot;135&quot;&gt;18/05/19 10:13             &lt;/td&gt;          &lt;/tr&gt;&lt;tr valign=&quot;top&quot;&gt;            &lt;td width=&quot;19&quot;&gt;&lt;i&gt;3&lt;/i&gt;            &lt;/td&gt;            &lt;td width=&quot;135&quot;&gt;18/05/19 17:05             &lt;/td&gt;          &lt;/tr&gt;&lt;/tbody&gt;      &lt;/table&gt;&lt;/td&gt;      &lt;td&gt;&lt;table border=&quot;1&quot; cellpadding=&quot;4&quot; cellspacing=&quot;0&quot; height=&quot;135&quot;&gt;        &lt;colgroup&gt;&lt;col width=&quot;19&quot; /&gt; &lt;col width=&quot;136&quot; /&gt; &lt;/colgroup&gt;&lt;tbody&gt;&lt;tr&gt;            &lt;td colspan=&quot;2&quot; valign=&quot;top&quot; width=&quot;163&quot;&gt;&lt;span&gt;&lt;b&gt;Datos&lt;/b&gt;&lt;/span&gt;            &lt;/td&gt;          &lt;/tr&gt;&lt;tr valign=&quot;top&quot;&gt;            &lt;td width=&quot;19&quot;&gt;&lt;span&gt;&lt;b&gt;Id&lt;/b&gt;&lt;/span&gt;            &lt;/td&gt;            &lt;td width=&quot;136&quot;&gt;&lt;span&gt;&lt;b&gt;NombreAtributo&lt;/b&gt;&lt;/span&gt;            &lt;/td&gt;          &lt;/tr&gt;&lt;tr valign=&quot;top&quot;&gt;            &lt;td width=&quot;19&quot;&gt;&lt;i&gt;1&lt;/i&gt;            &lt;/td&gt;            &lt;td width=&quot;136&quot;&gt;Longitud             &lt;/td&gt;          &lt;/tr&gt;&lt;tr valign=&quot;top&quot;&gt;            &lt;td width=&quot;19&quot;&gt;&lt;i&gt;2&lt;/i&gt;            &lt;/td&gt;            &lt;td width=&quot;136&quot;&gt;Temperatura             &lt;/td&gt;          &lt;/tr&gt;&lt;tr valign=&quot;top&quot;&gt;            &lt;td width=&quot;19&quot;&gt;&lt;i&gt;3&lt;/i&gt;            &lt;/td&gt;            &lt;td width=&quot;136&quot;&gt;Volumen             &lt;/td&gt;          &lt;/tr&gt;&lt;tr valign=&quot;top&quot;&gt;            &lt;td width=&quot;19&quot;&gt;&lt;i&gt;4&lt;/i&gt;            &lt;/td&gt;            &lt;td width=&quot;136&quot;&gt;Sector             &lt;/td&gt;          &lt;/tr&gt;&lt;/tbody&gt;      &lt;/table&gt;&lt;/td&gt;      &lt;td&gt;&lt;div align=&quot;left&quot;&gt;&lt;/div&gt;&lt;table border=&quot;1&quot; cellpadding=&quot;4&quot; cellspacing=&quot;0&quot; height=&quot;159&quot;&gt;        &lt;colgroup&gt;&lt;col width=&quot;48&quot; /&gt; &lt;col width=&quot;59&quot; /&gt; &lt;col width=&quot;48&quot; /&gt; &lt;/colgroup&gt;&lt;tbody&gt;&lt;tr&gt;            &lt;td colspan=&quot;3&quot; valign=&quot;top&quot; width=&quot;170&quot;&gt;&lt;span&gt;&lt;b&gt;DatosIncidencia&lt;/b&gt;&lt;/span&gt;            &lt;/td&gt;          &lt;/tr&gt;&lt;tr valign=&quot;top&quot;&gt;            &lt;td width=&quot;48&quot;&gt;&lt;span&gt;&lt;b&gt;IdInc&lt;/b&gt;&lt;/span&gt;            &lt;/td&gt;            &lt;td width=&quot;59&quot;&gt;&lt;span&gt;&lt;b&gt;IdDato&lt;/b&gt;&lt;/span&gt;            &lt;/td&gt;            &lt;td width=&quot;48&quot;&gt;&lt;span&gt;&lt;b&gt;Valor&lt;/b&gt;&lt;/span&gt;            &lt;/td&gt;          &lt;/tr&gt;&lt;tr valign=&quot;top&quot;&gt;            &lt;td width=&quot;48&quot;&gt;&lt;i&gt;1&lt;/i&gt;            &lt;/td&gt;            &lt;td width=&quot;59&quot;&gt;&lt;i&gt;1&lt;/i&gt;            &lt;/td&gt;            &lt;td width=&quot;48&quot;&gt;5             &lt;/td&gt;          &lt;/tr&gt;&lt;tr valign=&quot;top&quot;&gt;            &lt;td width=&quot;48&quot;&gt;&lt;i&gt;1&lt;/i&gt;            &lt;/td&gt;            &lt;td width=&quot;59&quot;&gt;&lt;i&gt;4&lt;/i&gt;            &lt;/td&gt;            &lt;td width=&quot;48&quot;&gt;A             &lt;/td&gt;          &lt;/tr&gt;&lt;tr valign=&quot;top&quot;&gt;            &lt;td width=&quot;48&quot;&gt;&lt;i&gt;2&lt;/i&gt;            &lt;/td&gt;            &lt;td width=&quot;59&quot;&gt;&lt;i&gt;2&lt;/i&gt;            &lt;/td&gt;            &lt;td width=&quot;48&quot;&gt;6             &lt;/td&gt;          &lt;/tr&gt;&lt;tr valign=&quot;top&quot;&gt;            &lt;td width=&quot;48&quot;&gt;&lt;i&gt;2&lt;/i&gt;            &lt;/td&gt;            &lt;td width=&quot;59&quot;&gt;&lt;i&gt;3&lt;/i&gt;            &lt;/td&gt;            &lt;td width=&quot;48&quot;&gt;4             &lt;/td&gt;          &lt;/tr&gt;&lt;tr valign=&quot;top&quot;&gt;            &lt;td width=&quot;48&quot;&gt;&lt;i&gt;2&lt;/i&gt;            &lt;/td&gt;            &lt;td width=&quot;59&quot;&gt;&lt;i&gt;4&lt;/i&gt;            &lt;/td&gt;            &lt;td width=&quot;48&quot;&gt;A             &lt;/td&gt;          &lt;/tr&gt;&lt;/tbody&gt;      &lt;/table&gt;&lt;/td&gt;    &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;Los problemas que aporta este modelo son: &lt;br /&gt;&lt;ul&gt;&lt;li&gt;Consultas SQL complejas (muchos &quot;&lt;i&gt;CASE&quot;)&lt;/i&gt;, que en algunos casos deben usar herramientas típicas de datawarehouse (PIVOT, &lt;a href=&quot;http://www.postgresql.org/docs/8.3/static/tablefunc.html&quot;&gt;crosstab&lt;/a&gt;, etc), para convertir en columnas lo que, en realidad, son filas.&lt;/li&gt;&lt;li&gt;Tipo de dato único para todos los atributos, sean numéricos, fechas o cadenas, que luego deberán convertirse, o complicar el modelo con distintas tablas de atributos en función del tipo de dato.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;b&gt;XML y Xpath al rescate&lt;/b&gt;&lt;br /&gt;Una buena alternativa a este tipo de problemas es implementar un campo con XML y procesarlo con herramientas XPath. Lamentablemente, &lt;a href=&quot;http://www.postgresql.org/docs/8.3/interactive/datatype-xml.html&quot;&gt;el tipo de dato XML&lt;/a&gt; de PostgreSQL 8.3 aún no tiene operadores de comparación ni se pueden crear índices sobre este tipo de dato, pero se puede tratar como String y indexar expresiones XPath como veremos a continuación.&lt;br /&gt;&lt;br /&gt;La ventaja de usar XML es que podemos contar con un número de atributos variable &lt;i&gt;encapsulados&lt;/i&gt; en un documento XML en un sólo campo y evitar tener que usar el modelo EAV, por ejemplo: &amp;nbsp; &lt;br /&gt;&lt;br /&gt;&lt;table border=&quot;1&quot; cellpadding=&quot;4&quot; cellspacing=&quot;0&quot; height=&quot;116&quot;&gt; &lt;colgroup&gt;&lt;col width=&quot;24&quot; /&gt; &lt;col width=&quot;140&quot; /&gt; &lt;col width=&quot;440&quot; /&gt; &lt;/colgroup&gt;&lt;tbody&gt;&lt;tr&gt;  &lt;td colspan=&quot;3&quot; valign=&quot;top&quot; width=&quot;620&quot;&gt;&lt;span&gt;&lt;b&gt;Incidencia&lt;/b&gt;&lt;/span&gt;      &lt;/td&gt; &lt;/tr&gt;&lt;tr valign=&quot;top&quot;&gt;  &lt;td width=&quot;24&quot;&gt;&lt;span&gt;&lt;b&gt;Id&lt;/b&gt;&lt;/span&gt;      &lt;/td&gt;  &lt;td width=&quot;140&quot;&gt;&lt;span&gt;&lt;b&gt;Fecha&lt;/b&gt;&lt;/span&gt;      &lt;/td&gt;  &lt;td width=&quot;440&quot;&gt;&lt;span&gt;&lt;b&gt;DatosIncidencia&lt;/b&gt;&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr valign=&quot;top&quot;&gt;  &lt;td width=&quot;24&quot;&gt;&lt;i&gt;1&lt;/i&gt;     &lt;/td&gt;  &lt;td width=&quot;140&quot;&gt;17/05/19 22:10     &lt;/td&gt;  &lt;td width=&quot;440&quot;&gt;&lt;span&gt;&amp;lt;data&amp;gt;&amp;lt;longitud&amp;gt;5&amp;lt;/longitud&amp;gt;&amp;lt;sector&amp;gt;A&amp;lt;/sector&amp;gt;&amp;lt;/data&amp;gt;&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr valign=&quot;top&quot;&gt;  &lt;td width=&quot;24&quot;&gt;&lt;i&gt;2&lt;/i&gt;     &lt;/td&gt;  &lt;td width=&quot;140&quot;&gt;18/05/19 10:13     &lt;/td&gt;  &lt;td width=&quot;440&quot;&gt;&lt;span&gt;&amp;lt;data&amp;gt;&amp;lt;temperatura&amp;gt;5&amp;lt;/temperatura&amp;gt;&amp;lt;volumen&amp;gt;4&amp;lt;/volumen&amp;gt;&amp;lt;sector&amp;gt;A&amp;lt;/sector&amp;gt;&amp;lt;/data&amp;gt;&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&amp;nbsp; &lt;br /&gt;Con una tabla como la anterior, podemos realizar consultas sencillas con XPath, tipo &lt;br /&gt;&lt;pre class=&quot;SCREEN&quot;&gt;&lt;span&gt;&lt;b&gt;SELECT xpath('/data/temperatura/text()', DatosIncidencia)&lt;br /&gt;FROM incidencia&lt;/b&gt;&lt;/span&gt;&lt;/pre&gt;que nos permite un control total en la consulta de atributos sin complicadas consultas. Puede haber quien le parezca que XPath es complicado y que no se gana tanto, pero en mi opinión, es más sencillo tratar con un único campo y una única tabla aunque tengamos que realizar un pequeño aprendizaje de XPath. A la larga, todo es más simple: tanto las consultas como el mantenimiento.&lt;br /&gt;&lt;br /&gt;También se pueden optimizar ciertas consultas comunes creando índices, aunque usando &lt;a href=&quot;http://www.postgres.cz/index.php/PostgreSQL_SQL_Tricks#xpath_function_indexing&quot;&gt;algún truco&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;El soporte de XML &quot;de serie&quot; en PostgreSQL no ha hecho más que empezar, y le queda un gran camino por recorrer, pero ya estamos en disposición de empezar a aprovecharlo.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;b&gt;Referencias y más información:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://balteus.blogspot.com/2010/06/xml-con-postgresql.html&quot;&gt;XML con PostgreSQL&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/1763183641342103044-4151667638100525658?l=balteus.blogspot.com&quot; alt=&quot;&quot; /&gt;&lt;/div&gt;</content>
		<author>
			<name>Samuel Zarza Fernández</name>
			<email>noreply@blogger.com</email>
			<uri>http://balteus.blogspot.com/search/label/postgresql</uri>
		</author>
		<source>
			<title type="html">Balteus</title>
			<subtitle type="html">tres estrellas alineadas</subtitle>
			<link rel="self" href="http://balteus.blogspot.com/feeds/posts/default/-/postgresql"/>
			<id>tag:blogger.com,1999:blog-1763183641342103044</id>
			<updated>2012-05-19T06:30:05+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="es">
		<title type="html">¿Dónde están nuestros datos en el disco?</title>
		<link href="http://www.postgresql.org.es/node/668"/>
		<id>http://www.postgresql.org.es/668 at http://www.postgresql.org.es</id>
		<updated>2011-10-07T10:06:49+00:00</updated>
		<content type="html">&lt;div class=&quot;image-attach-teaser image-attach-node-273&quot;&gt;&lt;a href=&quot;http://www.postgresql.org.es/node/668&quot;&gt;&lt;img src=&quot;http://www.postgresql.org.es/sites/default/files/images/server.blog.jpg&quot; alt=&quot;servidor&quot; title=&quot;servidor&quot; class=&quot;image image-blog &quot; width=&quot;95&quot; height=&quot;100&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;p&gt;Acabo de publicar un artículo sobre como PostgreSQL graba y organiza nuestros datos en el disco. Una introducción a un tema que todo administrador de bases de datos deberia saber algo sobre el mismo.&lt;/p&gt;
&lt;p&gt;El artículo se titula &quot;¿Dónde están nuestros datos en el disco?&quot; y está disponible en &lt;a href=&quot;http://www.postgresql.org.es/node/667&quot; title=&quot;http://www.postgresql.org.es/node/667&quot;&gt;http://www.postgresql.org.es/node/667&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;--&lt;br /&gt;
Rafael Martinez Guerrero&lt;br /&gt;
PostgreSQL-es&lt;/p&gt;</content>
		<author>
			<name>Rafael Martinez</name>
			<uri>http://www.postgresql.org.es/rafaelma</uri>
		</author>
		<source>
			<title type="html">rafaelma's blog</title>
			<link rel="self" href="http://www.postgresql.org.es/rafaelma/feed"/>
			<id>http://www.postgresql.org.es/rafaelma/feed</id>
			<updated>2012-05-19T13:30:08+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="es">
		<title type="html">Nuevas versiones de PostgreSQL disponibles</title>
		<link href="http://www.postgresql.org.es/node/657"/>
		<id>http://www.postgresql.org.es/657 at http://www.postgresql.org.es</id>
		<updated>2011-09-26T19:36:14+00:00</updated>
		<content type="html">&lt;div class=&quot;image-attach-teaser image-attach-node-340&quot;&gt;&lt;a href=&quot;http://www.postgresql.org.es/node/657&quot;&gt;&lt;img src=&quot;http://www.postgresql.org.es/sites/default/files/images/postgres-logo.png&quot; alt=&quot;postgres-logo&quot; title=&quot;postgres-logo&quot; class=&quot;image image-blog &quot; width=&quot;64&quot; height=&quot;64&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;p&gt;El proyecto PostgreSQL ha lanzado nuevas versiones menores de todas las series activas de PostgreSQL. Las nuevas versiones disponibles son 9.1.1, 9.0.5, 8.4.9, 8.3.16 y 8.2.22. Recordamos que la serie 8.2 dejará de actualizarse a partir de noviembre 2011.&lt;/p&gt;
&lt;p&gt;Anuncio oficial de este lanzamiento:&lt;br /&gt;
&lt;a href=&quot;http://www.postgresql.org/about/news.1355&quot; title=&quot;http://www.postgresql.org/about/news.1355&quot;&gt;http://www.postgresql.org/about/news.1355&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Más información sobre las versiones lanzadas:&lt;br /&gt;
&lt;a href=&quot;http://www.postgresql.org/docs/current/static/release.html&quot; title=&quot;http://www.postgresql.org/docs/current/static/release.html&quot;&gt;http://www.postgresql.org/docs/current/static/release.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Descargas:&lt;br /&gt;
&lt;a href=&quot;http://www.postgresql.org/download/&quot; title=&quot;http://www.postgresql.org/download/&quot;&gt;http://www.postgresql.org/download/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Código fuente:&lt;br /&gt;
&lt;a href=&quot;http://www.postgresql.org/ftp/source/&quot; title=&quot;http://www.postgresql.org/ftp/source/&quot;&gt;http://www.postgresql.org/ftp/source/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Instalador fácil:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.postgresql.org.es/node/657&quot; target=&quot;_blank&quot;&gt;leer más&lt;/a&gt;&lt;/p&gt;</content>
		<author>
			<name>Rafael Martinez</name>
			<uri>http://www.postgresql.org.es/rafaelma</uri>
		</author>
		<source>
			<title type="html">rafaelma's blog</title>
			<link rel="self" href="http://www.postgresql.org.es/rafaelma/feed"/>
			<id>http://www.postgresql.org.es/rafaelma/feed</id>
			<updated>2012-05-19T13:30:08+00:00</updated>
		</source>
	</entry>

	<entry>
		<title type="html">Cómo clonar una tabla en PostgreSQL</title>
		<link href="http://sparcki.blogspot.com/2011/09/como-clonar-una-tabla-en-postgresql.html"/>
		<id>tag:blogger.com,1999:blog-3023674627195806772.post-2227976307069214322</id>
		<updated>2011-09-24T11:46:12+00:00</updated>
		<content type="html">&lt;b&gt;Introducción&lt;/b&gt;&lt;br /&gt;Alguna vez hemos necesitado &lt;i&gt;clonar&lt;/i&gt; una tabla, tanto estructura como contenido desde el propio SQL sin tener que recurrir a &amp;lt;pg_dump&amp;gt;.&lt;br /&gt;Tal vez alguno esté pensando en un &lt;b&gt;CREATE TABLE AS SELECT ...&lt;/b&gt; pero lo cierto es que esta solución no nos crea los modificadores, índices, etc.&lt;br /&gt;&lt;br /&gt;Sin embargo, no os preocupéis, que en PostgreSQL se puede hacer todo, o casi, y este caso sí que está muy resuelto.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Pasos Ejemplo de Clonado &quot;completo&quot;&lt;/b&gt;&lt;br /&gt;A continuación os muestro -de una forma sencilla- lo que vamos a hacer, paso a paso para que no resulte complicado:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Crearemos una tabla llamada &lt;b&gt;test&lt;/b&gt; con los campos &lt;b&gt;company&lt;/b&gt; y &lt;b&gt;homepage&lt;/b&gt;&lt;/li&gt;&lt;li&gt;Añadiremos un &lt;b&gt;índice único&lt;/b&gt; en &lt;b&gt;company&lt;/b&gt;&lt;/li&gt;&lt;li&gt;Añadiremos un par de compañías&lt;/li&gt;&lt;li&gt;Crearemos una tabla nueva copiando el contenido de la tabla con un &lt;b&gt;CREATE TABLE&amp;nbsp; AS SELECT&lt;/b&gt; para comprobar cómo no clona los &lt;b&gt;índices, defaults, etc.&lt;/b&gt;&lt;/li&gt;&lt;li&gt;Utilizaremos un &lt;b&gt;clonado completo &lt;/b&gt;&lt;/li&gt;&lt;/ol&gt;Una vez explicado, vamos a ponernos manos a la obra&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;search=&amp;gt; &lt;b&gt;CREATE TABLE test(company VARCHAR(20) NOT NULL, homepage VARCHAR(40) NOT NULL);&lt;/b&gt;&lt;br /&gt;CREATE TABLE&lt;br /&gt;search=&amp;gt; &lt;b&gt;CREATE UNIQUE INDEX test_company_uq ON test(company);&lt;/b&gt;&lt;br /&gt;CREATE INDEX&lt;br /&gt;search=&amp;gt; &lt;b&gt;\d test&lt;/b&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Table &quot;public.test&quot;&lt;br /&gt;&amp;nbsp; Column&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Type&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | Modifiers &lt;br /&gt;----------+-----------------------+-----------&lt;br /&gt;&amp;nbsp;company&amp;nbsp; | character varying(20) | not null&lt;br /&gt;&amp;nbsp;homepage | character varying(40) | not null&lt;br /&gt;Indexes:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;test_company_uq&quot; UNIQUE, btree (company)&lt;/blockquote&gt;&lt;div&gt;&lt;/div&gt;&lt;br /&gt;Ahora, añadimos un par de registros&lt;br /&gt;&lt;blockquote&gt;search=&amp;gt; &lt;b&gt;INSERT INTO test(company,homepage) VALUES('SFChildren', 'http://www.sfchildren.com');&lt;/b&gt;&lt;br /&gt;INSERT 0 1&lt;br /&gt;search=&amp;gt; &lt;b&gt;INSERT INTO test(company,homepage) VALUES('HavocTec', 'http://www.havoctec.com');&lt;/b&gt;&lt;br /&gt;INSERT 0 1&lt;br /&gt;search=&amp;gt; &lt;b&gt;SELECT * FROM test;&lt;/b&gt;&lt;br /&gt;&amp;nbsp; company&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; homepage&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;------------+---------------------------&lt;br /&gt;&amp;nbsp;SFChildren | http://www.sfchildren.com&lt;br /&gt;&amp;nbsp;HavocTec&amp;nbsp;&amp;nbsp; | http://www.havoctec.com&lt;br /&gt;(2 rows)&lt;/blockquote&gt;Copiamos su contenido utilizando &lt;b&gt;CREATE TABLE newTable AS SELECT * FROM sourceTable &lt;/b&gt;y comprobaremos su resultado&lt;br /&gt;&lt;blockquote&gt;search=&amp;gt; &lt;b&gt;CREATE TABLE test2 AS SELECT * FROM test;&lt;/b&gt;&lt;br /&gt;SELECT&lt;br /&gt;search=&amp;gt; &lt;b&gt;\d test2&lt;/b&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Table &quot;public.test2&quot;&lt;br /&gt;&amp;nbsp; Column&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Type&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | Modifiers &lt;br /&gt;----------+-----------------------+-----------&lt;br /&gt;&amp;nbsp;company&amp;nbsp; | character varying(20) | &lt;br /&gt;&amp;nbsp;homepage | character varying(40) | &lt;/blockquote&gt;Como podemos observar, lo primero que nos falta es el índice que hemos creado &amp;lt;test_company_uq&amp;gt; y los modificadores &amp;lt;NOT NULL&amp;gt; en ambos campos.&lt;br /&gt;&lt;br /&gt;Es decir, utilizando esta forma &lt;b&gt;copiamos el contenido y estructura de campos pero no sus modificadores&lt;/b&gt;, pero, que no cunda el pánico, vamos a ver cómo lo podemos hacer de una forma sencilla.&lt;br /&gt;&lt;br /&gt;Borramos la tabla test2 que hemos creado para poder volver a clonarla, esta vez de forma completa. &lt;br /&gt;&lt;blockquote&gt;search=&amp;gt; &lt;b&gt;DROP TABLE test2;&lt;/b&gt;&lt;br /&gt;DROP TABLE&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Clonar &quot;todo&quot;, para ello vamos a utilizar los modificadores &lt;b&gt;LIKE tabla INCLUIDING [DEFAULTS | CONSTRAINTS | INDEXES]&lt;/b&gt;. En nuestro ejemplo, queremos &quot;clonar&quot; toda la estructura&amp;nbsp; así que utilizamos todas.&lt;br /&gt;&lt;blockquote&gt;search=&amp;gt; &lt;b&gt;CREATE TABLE test2 (LIKE test INCLUDING DEFAULTS INCLUDING CONSTRAINTS INCLUDING INDEXES);&lt;/b&gt;&lt;br /&gt;CREATE TABLE&lt;br /&gt;search=&amp;gt; &lt;b&gt;\d test2&lt;/b&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Table &quot;public.test2&quot;&lt;br /&gt;&amp;nbsp; Column&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Type&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | Modifiers &lt;br /&gt;----------+-----------------------+-----------&lt;br /&gt;&amp;nbsp;company&amp;nbsp; | character varying(20) | not null&lt;br /&gt;&amp;nbsp;homepage | character varying(40) | not null&lt;br /&gt;Indexes:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;test2_company_key&quot; UNIQUE, btree (company)&lt;/blockquote&gt;&lt;b&gt;Conclusiones&lt;/b&gt;&lt;br /&gt;Aunque el ejemplo es sencillo, la idea era mostrar la potencia de la opción LIKE ... INCLUIDING sin tener que mostrar una estructura muy compleja.&lt;br /&gt;&lt;br /&gt;Además, para aquellos que no os guste el SQL, siempre podéis utilizar el comando &amp;lt;pg_dump&amp;gt; para exportar una tabla.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Referencias&lt;/b&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://sparcki.blogspot.com/2010/11/copias-de-seguridad-y-recuperacion-en.html&quot;&gt;Copias de Seguridad en PostgreSQL - Parte 1&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://sparcki.blogspot.com/2010/09/instalacion-de-postgresql-en.html&quot;&gt;Instalación de PostgreSQL en OpenIndiana - Parte 1&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/3023674627195806772-2227976307069214322?l=sparcki.blogspot.com&quot; alt=&quot;&quot; /&gt;&lt;/div&gt;</content>
		<author>
			<name>Urko Benito</name>
			<email>noreply@blogger.com</email>
			<uri>http://sparcki.blogspot.com/search/label/postgres</uri>
		</author>
		<source>
			<title type="html">Solaris Black Box :: El Blog en Castellano</title>
			<subtitle type="html">Blog donde comento mis historias con el sistema operativo Sun Solaris durante todos estos años de lucha y placer.</subtitle>
			<link rel="self" href="http://sparcki.blogspot.com/feeds/posts/default/-/postgres"/>
			<id>tag:blogger.com,1999:blog-3023674627195806772</id>
			<updated>2012-05-19T06:30:10+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="es">
		<title type="html">PGDay Ecuador 2011</title>
		<link href="http://www.ecualug.org/2011/09/15/blog/jcasano/pgday_ecuador_2011"/>
		<id>http://www.ecualug.org/16348 at http://www.ecualug.org</id>
		<updated>2011-09-16T00:02:50+00:00</updated>
		<content type="html">&lt;!-- google_ad_section_start --&gt;  &lt;p&gt;Por primera vez en Ecuador se realizará un PGDay. ¿Pero que es un PGDay y por qué deberíamos hacer uno?&lt;/p&gt;
  &lt;!-- google_ad_section_end --&gt;&lt;p&gt;&lt;a href=&quot;http://www.ecualug.org/2011/09/15/blog/jcasano/pgday_ecuador_2011&quot; target=&quot;_blank&quot;&gt;leer más&lt;/a&gt;&lt;/p&gt;</content>
		<author>
			<name>Jaime Casanova</name>
			<uri>http://www.ecualug.org/blog/jcasano</uri>
		</author>
		<source>
			<title type="html">jcasano's blog</title>
			<subtitle type="html">¡Te damos la bienvenida a EcuaLUG (&quot;Ecuador GNU/Linux User Group&quot;) es un portal dedicado a difundir el uso e ideales de GNU/Linux® y del Software Libre, proporcionar servicios e información relacionadas a sistemas GNU/Linux® .


No tenemos relación laboral con empresa alguna dedicada a la comercialización de alguna distribución de GNU/Linux®.


¡No olvides registrarte!, como usuario tendrás muchas ventajas y opciones disponibles; como hacer consulta a los usuarios, participar en encuestas, enviar noticias y realizar comentarios, y muchas otras cosas más.


¡Tu opinión sobre el portal es bienvenida para el mejoramiento del mismo!


¡Que lo disfrutes!</subtitle>
			<link rel="self" href="http://www.ecualug.org/blog/1934/feed"/>
			<id>http://www.ecualug.org/blog/1934/feed</id>
			<updated>2012-05-19T13:30:05+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="es">
		<title type="html">PostgreSQL 9.1 ha sido liberado</title>
		<link href="http://www.ecualug.org/2011/09/12/blog/jcasano/postgresql_91_ha_sido_liberado"/>
		<id>http://www.ecualug.org/16333 at http://www.ecualug.org</id>
		<updated>2011-09-12T15:53:10+00:00</updated>
		<content type="html">&lt;!-- google_ad_section_start --&gt;  &lt;p&gt;12 de Septiembre del 2011: El Grupo Global de Desarrollo de PostgreSQL anuncia el lanzamiento de PostgreSQL 9.1. Esta nueva versión de la bases de datos de código abierto líder ofrece tecnología innovadora, extensibilidad sin igual, y nuevas características como replicación sincrónica, método de indexado &quot;K-Nearest Neighbor&quot;, and conectores de datos foráneos.&lt;/p&gt;
  &lt;!-- google_ad_section_end --&gt;&lt;p&gt;&lt;a href=&quot;http://www.ecualug.org/2011/09/12/blog/jcasano/postgresql_91_ha_sido_liberado&quot; target=&quot;_blank&quot;&gt;leer más&lt;/a&gt;&lt;/p&gt;</content>
		<author>
			<name>Jaime Casanova</name>
			<uri>http://www.ecualug.org/blog/jcasano</uri>
		</author>
		<source>
			<title type="html">jcasano's blog</title>
			<subtitle type="html">¡Te damos la bienvenida a EcuaLUG (&quot;Ecuador GNU/Linux User Group&quot;) es un portal dedicado a difundir el uso e ideales de GNU/Linux® y del Software Libre, proporcionar servicios e información relacionadas a sistemas GNU/Linux® .


No tenemos relación laboral con empresa alguna dedicada a la comercialización de alguna distribución de GNU/Linux®.


¡No olvides registrarte!, como usuario tendrás muchas ventajas y opciones disponibles; como hacer consulta a los usuarios, participar en encuestas, enviar noticias y realizar comentarios, y muchas otras cosas más.


¡Tu opinión sobre el portal es bienvenida para el mejoramiento del mismo!


¡Que lo disfrutes!</subtitle>
			<link rel="self" href="http://www.ecualug.org/blog/1934/feed"/>
			<id>http://www.ecualug.org/blog/1934/feed</id>
			<updated>2012-05-19T13:30:05+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="es">
		<title type="html">Lanzamiento de PostgreSQL 9.1</title>
		<link href="http://www.postgresql.org.es/node/655"/>
		<id>http://www.postgresql.org.es/655 at http://www.postgresql.org.es</id>
		<updated>2011-09-12T12:59:21+00:00</updated>
		<content type="html">&lt;div class=&quot;image-attach-teaser image-attach-node-340&quot;&gt;&lt;a href=&quot;http://www.postgresql.org.es/node/655&quot;&gt;&lt;img src=&quot;http://www.postgresql.org.es/sites/default/files/images/postgres-logo.png&quot; alt=&quot;postgres-logo&quot; title=&quot;postgres-logo&quot; class=&quot;image image-blog &quot; width=&quot;64&quot; height=&quot;64&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;p&gt;Hoy se lanza una nueva versión principal de PostgreSQL, la versión 9.1. Después de un año de desarrollo y pruebas, este lanzamiento trae muchas características nuevas y potentes.&lt;/p&gt;
&lt;p&gt;A continuación teneis un resumen de la nota de prensa oficial. El documento completo lo teneis en &lt;a href=&quot;http://www.postgresql.org/about/press/presskit91.html.es&quot; title=&quot;http://www.postgresql.org/about/press/presskit91.html.es&quot;&gt;http://www.postgresql.org/about/press/presskit91.html.es&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.postgresql.org.es/node/655&quot; target=&quot;_blank&quot;&gt;leer más&lt;/a&gt;&lt;/p&gt;</content>
		<author>
			<name>Rafael Martinez</name>
			<uri>http://www.postgresql.org.es/rafaelma</uri>
		</author>
		<source>
			<title type="html">rafaelma's blog</title>
			<link rel="self" href="http://www.postgresql.org.es/rafaelma/feed"/>
			<id>http://www.postgresql.org.es/rafaelma/feed</id>
			<updated>2012-05-19T13:30:08+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="es">
		<title type="html">Revista PostgreSQL</title>
		<link href="http://www.ecualug.org/2011/08/25/blog/jcasano/revista_postgresql"/>
		<id>http://www.ecualug.org/16291 at http://www.ecualug.org</id>
		<updated>2011-08-25T23:03:36+00:00</updated>
		<content type="html">&lt;!-- google_ad_section_start --&gt;  &lt;p&gt;En Mayo de este año se lanzo la edición # 00 de pgmag que es la primera revista exclusivamente sobre PostgreSQL.&lt;br /&gt;
En realidad eso fue solo una prueba, que al parecer ha sido exitosa con mas de 4000 descargas de la página y se ha repartido en varios eventos.&lt;/p&gt;
&lt;p&gt;Ha decir verdad, pensaba anunciarla por aqui pero esperaba a que se terminará la traducción al español que aparentemente no termino &lt;img src=&quot;http://www.ecualug.org/modules/smileys/packs/Example/sad.png&quot; title=&quot;Sad&quot; alt=&quot;Sad&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
  &lt;!-- google_ad_section_end --&gt;&lt;p&gt;&lt;a href=&quot;http://www.ecualug.org/2011/08/25/blog/jcasano/revista_postgresql&quot; target=&quot;_blank&quot;&gt;leer más&lt;/a&gt;&lt;/p&gt;</content>
		<author>
			<name>Jaime Casanova</name>
			<uri>http://www.ecualug.org/blog/jcasano</uri>
		</author>
		<source>
			<title type="html">jcasano's blog</title>
			<subtitle type="html">¡Te damos la bienvenida a EcuaLUG (&quot;Ecuador GNU/Linux User Group&quot;) es un portal dedicado a difundir el uso e ideales de GNU/Linux® y del Software Libre, proporcionar servicios e información relacionadas a sistemas GNU/Linux® .


No tenemos relación laboral con empresa alguna dedicada a la comercialización de alguna distribución de GNU/Linux®.


¡No olvides registrarte!, como usuario tendrás muchas ventajas y opciones disponibles; como hacer consulta a los usuarios, participar en encuestas, enviar noticias y realizar comentarios, y muchas otras cosas más.


¡Tu opinión sobre el portal es bienvenida para el mejoramiento del mismo!


¡Que lo disfrutes!</subtitle>
			<link rel="self" href="http://www.ecualug.org/blog/1934/feed"/>
			<id>http://www.ecualug.org/blog/1934/feed</id>
			<updated>2012-05-19T13:30:05+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="es">
		<title type="html">Auditoría de tablas</title>
		<link href="http://www.ecualug.org/2011/07/18/blog/jcasano/auditor%C3%ADa_de_tablas"/>
		<id>http://www.ecualug.org/16137 at http://www.ecualug.org</id>
		<updated>2011-07-18T07:36:04+00:00</updated>
		<content type="html">&lt;!-- google_ad_section_start --&gt;  &lt;p&gt;¿Con qué frecuencia se le ha pedido a alguno de ustedes que se registren todos los cambios de las tablas para auditoria? AFAIR, todos y cada uno de los clientes que he tenido me ha pedido esto&lt;/p&gt;
&lt;p&gt;Hasta ahora, he usado table_log (http://pgfoundry.org/projects/tablelog) para eso, pero eso esta lejos de ser una solución ideal por varias razones.&lt;/p&gt;
  &lt;!-- google_ad_section_end --&gt;&lt;p&gt;&lt;a href=&quot;http://www.ecualug.org/2011/07/18/blog/jcasano/auditor%C3%ADa_de_tablas&quot; target=&quot;_blank&quot;&gt;leer más&lt;/a&gt;&lt;/p&gt;</content>
		<author>
			<name>Jaime Casanova</name>
			<uri>http://www.ecualug.org/blog/jcasano</uri>
		</author>
		<source>
			<title type="html">jcasano's blog</title>
			<subtitle type="html">¡Te damos la bienvenida a EcuaLUG (&quot;Ecuador GNU/Linux User Group&quot;) es un portal dedicado a difundir el uso e ideales de GNU/Linux® y del Software Libre, proporcionar servicios e información relacionadas a sistemas GNU/Linux® .


No tenemos relación laboral con empresa alguna dedicada a la comercialización de alguna distribución de GNU/Linux®.


¡No olvides registrarte!, como usuario tendrás muchas ventajas y opciones disponibles; como hacer consulta a los usuarios, participar en encuestas, enviar noticias y realizar comentarios, y muchas otras cosas más.


¡Tu opinión sobre el portal es bienvenida para el mejoramiento del mismo!


¡Que lo disfrutes!</subtitle>
			<link rel="self" href="http://www.ecualug.org/blog/1934/feed"/>
			<id>http://www.ecualug.org/blog/1934/feed</id>
			<updated>2012-05-19T13:30:05+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="es">
		<title type="html">Segundo día del CHAR(11)</title>
		<link href="http://www.ecualug.org/2011/07/14/blog/jcasano/segundo_d%C3%ADa_del_char11"/>
		<id>http://www.ecualug.org/16126 at http://www.ecualug.org</id>
		<updated>2011-07-14T08:33:15+00:00</updated>
		<content type="html">&lt;!-- google_ad_section_start --&gt;  &lt;p&gt;Como comente en el artículo anterior de este blog, el 11 y 12 de Julio se realizó la conferencia CHAR(11). Y al igual que el lunes 11, el programa del martes 12 fue impresionante. Así que aprovechare el viaje en tren a Londres para comentarles un poco lo que pasó.&lt;/p&gt;
  &lt;!-- google_ad_section_end --&gt;&lt;p&gt;&lt;a href=&quot;http://www.ecualug.org/2011/07/14/blog/jcasano/segundo_d%C3%ADa_del_char11&quot; target=&quot;_blank&quot;&gt;leer más&lt;/a&gt;&lt;/p&gt;</content>
		<author>
			<name>Jaime Casanova</name>
			<uri>http://www.ecualug.org/blog/jcasano</uri>
		</author>
		<source>
			<title type="html">jcasano's blog</title>
			<subtitle type="html">¡Te damos la bienvenida a EcuaLUG (&quot;Ecuador GNU/Linux User Group&quot;) es un portal dedicado a difundir el uso e ideales de GNU/Linux® y del Software Libre, proporcionar servicios e información relacionadas a sistemas GNU/Linux® .


No tenemos relación laboral con empresa alguna dedicada a la comercialización de alguna distribución de GNU/Linux®.


¡No olvides registrarte!, como usuario tendrás muchas ventajas y opciones disponibles; como hacer consulta a los usuarios, participar en encuestas, enviar noticias y realizar comentarios, y muchas otras cosas más.


¡Tu opinión sobre el portal es bienvenida para el mejoramiento del mismo!


¡Que lo disfrutes!</subtitle>
			<link rel="self" href="http://www.ecualug.org/blog/1934/feed"/>
			<id>http://www.ecualug.org/blog/1934/feed</id>
			<updated>2012-05-19T13:30:05+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="es">
		<title type="html">Primer día del CHAR(11)</title>
		<link href="http://www.ecualug.org/2011/07/12/blog/jcasano/primer_d%C3%ADa_del_char11"/>
		<id>http://www.ecualug.org/16115 at http://www.ecualug.org</id>
		<updated>2011-07-12T08:37:45+00:00</updated>
		<content type="html">&lt;!-- google_ad_section_start --&gt;  &lt;p&gt;El día de ayer, 11 de Julio, dio inicio a la conferencia denominada CHAR(11) (un interesante uso de siglas para Clustering, High Availability and Replication).&lt;/p&gt;
  &lt;!-- google_ad_section_end --&gt;&lt;p&gt;&lt;a href=&quot;http://www.ecualug.org/2011/07/12/blog/jcasano/primer_d%C3%ADa_del_char11&quot; target=&quot;_blank&quot;&gt;leer más&lt;/a&gt;&lt;/p&gt;</content>
		<author>
			<name>Jaime Casanova</name>
			<uri>http://www.ecualug.org/blog/jcasano</uri>
		</author>
		<source>
			<title type="html">jcasano's blog</title>
			<subtitle type="html">¡Te damos la bienvenida a EcuaLUG (&quot;Ecuador GNU/Linux User Group&quot;) es un portal dedicado a difundir el uso e ideales de GNU/Linux® y del Software Libre, proporcionar servicios e información relacionadas a sistemas GNU/Linux® .


No tenemos relación laboral con empresa alguna dedicada a la comercialización de alguna distribución de GNU/Linux®.


¡No olvides registrarte!, como usuario tendrás muchas ventajas y opciones disponibles; como hacer consulta a los usuarios, participar en encuestas, enviar noticias y realizar comentarios, y muchas otras cosas más.


¡Tu opinión sobre el portal es bienvenida para el mejoramiento del mismo!


¡Que lo disfrutes!</subtitle>
			<link rel="self" href="http://www.ecualug.org/blog/1934/feed"/>
			<id>http://www.ecualug.org/blog/1934/feed</id>
			<updated>2012-05-19T13:30:05+00:00</updated>
		</source>
	</entry>

</feed>

