Customers have often asked me what I think of “Entity-attribute-value” (EAV) design. So I thought it would be a good idea to lay down my […]
Category: PostgreSQL
Paranoid SQL Execution on Postgres
Suppose that you want to be completely over-the-top paranoid about making sure that when you execute some particular SQL statement on your Postgres database, you’re […]
Primary Key Index is a Space Hog
Tables in PostgreSQL have an index for the primary key and separate row storage called the heap. Other databases integrate these together or support “index-organized […]
How To Install PostgreSQL With Docker Quickly
Many developers still install a database on their computer and work on it. It may be a preferable method, but using Docker takes only seconds […]
Copiar usaurio de un postgres a otro:
/usr/pgsql-11/bin/pg_dumpall -p 5432 -U postgres -r | /usr/pgsql-11/bin/psql -p 5433
PostgreSQL Readonly User
Rational When you create a user in postgresql, even with only select only permission, your user has a lot more privileges. Solution Connect with root […]
DELETE con LIMIT en Postgres
Sucio y desprolijo: WITH cte AS ( SELECT my_rowid /* your PK */ FROM batch WHERE bat_close_time_stamp <= 1507381943.93144 /* your condition */ /* ORDER […]
Foreign data wrappers en Postgres
Quien no se encontro alguna vez con la necesidad de traer algun dato desde un SQL Server a un Postgres…??? Bien, tenia esto: Un postgres […]
pgAdmin 4 v1.1, pros y contras.
El pgAdmin III, tiene sucesor, un completamente nuevo pgAdmin 4 que por desgracia esta muuuuuuuuy verde. Lo pueden encontrar en su sitio: pgadmin.org Pros: Soporta […]
Datazo V
SELECT unnest(string_to_array(‘1,2,3,4’, ‘,’)) un string lo transformas a un array y el unnest te lo pone en filitas… bien tecnico Saludos,
Copiar una base de datos en Postgres
Para copiar una base, primero hay que tenerla sin usuarios conectados… los sacamos: SELECT pg_terminate_backend(pid) –* FROM pg_stat_activity WHERE pid <> pg_backend_pid() –and query = […]
DATAZO IV – Modulo PG_TRGM
La única función que analice de acá fue la “similarity”. En XXXX la estamos usando para buscar PABLO PEREZ o PEREZ PABLO, independientemente como lo […]
Como ver el estado del servidor postgressql sin ser superuser
CREATE FUNCTION get_sa() RETURNS SETOF pg_stat_activity AS $$ SELECT * FROM pg_catalog.pg_stat_activity; $$ LANGUAGE sql VOLATILE SECURITY DEFINER; CREATE VIEW pg_stat_activity_allusers AS SELECT * FROM […]
DATAZO III – Funciones de string en Postgres, conocidas y desconocidas
n buen resumen de muchisimas funciones de strings, conocidas y desconocidas: http://postgresql-backup.com/postgresql-blog/postgres-string-functions/ Todo en un PDF: http://postgresql-backup.com/postgresql-blog/wp-content/uploads/2016/06/PostgreSQL-Cheat-Sheet_-String-Functions.pdf Por ejemplo, cómo parsear un string separado por […]
Postgres Datazo II
Ayer Leo necesitaba corregir un sp de XXXX en Produccion. Me pidio por mantis corregirlo una vez, lo ejecutó y tuvo otro error. Me pidio […]
Datazo
Recién tuve que hacer un insert masivo de registros borrados por error (desde Chaco) sobre una tabla de Prevencion PROD que tiene TRIGGGERS. Tomé los […]
CAMBIAR ENCODING DE UTF-8 A LATIN1 EN POSTGRESQL
El cambio es muy simple, primero ingresamos al terminal toot linux y ejecutamos su – postgres Ya estamos como usuario postgres Entramos al Postgresql ejecutando […]
Esto es Hibernate
La peor consulta que me han pedido que revise en mi vida, por lejos. Esto se debe al uso de la herramienta Hibernate total, que […]