Base de datos PostgreSQL desde Cero (Anotaciones)
Toda la información esta basada en muchos sitos web sobre todo de las siguientes personas:
Qué es una Base de Datos?
Sistema Gestor de Bases de Datos. (DBMS)
Es la herramienta de software que permite administrar una base de datos.
Para el presente curso utilizaremos el SGBDR Llamado Postgresql.
Instalación de PostgreSQL (Basado en Debian)
sudo aptitude install postgresql
Conexión a postgreSQL con el cliente de consola
psql -U postgres
psql: FATAL: Peer authentication failed for user "postgres"
Para corregir el error de la conexión Peer para el usuario postgresql, se debe modificar el archivo:
sudo vim /etc/postgresql/9.5/main/pg_hba.conf
Cambiar
local all postgres peer
Por
local all postgres trust
sudo systemctl restart postgresql
Nota: Cuando se hace esto ya no presenta el error de conexión local Peer, pero esto lleva a que cualquiera que tenga acceso al equipo puede acceder a PostgreSQL
psql -U postgres
psql (9.5.4)
Type "help" for help.
postgres=# SELECT 'Hola Mundo';
?column?
------------
Hola Mundo
(1 row)
postgres=#
Por tanto seria muy recomendable cambiar la clave del ROLE postgres
postgres=# ALTER ROLE postgres PASSWORD 'SuClaveSegura';
Creación de Role
CREATE ROLE freddy LOGIN PASSWORD 'su_clave_va_aquí'
Creación de Bases de Datos
CREATE DATABASE nombre_de_la_base_de_datos OWNER dueño_de_la_db;
CREATE DATABASE pruebas OWNER freddy;
Creación de Tablas
create table nombre_de_tabla(campo tipo_de_datos(tamaño));
create table prueba(nombre varchar(200));
Insertar Datos a tablas
insert into nombre_de_tabla values('dato_a_insertar);
insert into prueba values('freddy');
Permitir acceso remoto al PostgreSQL
Se debe editar sudo postgresql.conf y cambiar:
sudo vim /etc/postgresql/9.5/main/postgresql.conf
#listen_addresses = 'localhost'
Por:
listen_addresses = '*'
sudo vim /etc/postgresql/9.5/main/pg_hba.conf
# IPv4 local connections:
host all all 0.0.0.0/0 md5
sudo systemctl restart postgresql
Meta Comando
Nos permiten realizar acciones básicas de amdnisración sobre le servidor de PostgreSQL, y siempre se debe colocar el simbolo \
Muestra una lista de todos los comando existentes
pruebas=> \?
General
\copyright show PostgreSQL usage and distribution terms
\g [FILE] or ; execute query (and send results to file or |pipe)
\gset [PREFIX] execute query and store results in psql variables
\q quit psql
\watch [SEC] execute query every SEC seconds
Help
\? [commands] show help on backslash commands
\? options show help on psql command-line options
\? variables show help on special variables
\h [NAME] help on syntax of SQL commands, * for all commands
Query Buffer
\e [FILE] [LINE] edit the query buffer (or file) with external editor
\ef [FUNCNAME [LINE]] edit function definition with external editor
\p show the contents of the query buffer
\r reset (clear) the query buffer
\s [FILE] display history or save it to file
\w FILE write query buffer to file
Input/Output
\copy ... perform SQL COPY with data stream to the client host
\echo [STRING] write string to standard output
\i FILE execute commands from file
\ir FILE as \i, but relative to location of current script
\o [FILE] send all query results to file or |pipe
\qecho [STRING] write string to query output stream (see \o)
Informational
(options: S = show system objects, + = additional detail)
\d[S+] list tables, views, and sequences
\d[S+] NAME describe table, view, sequence, or index
\da[S] [PATTERN] list aggregates
\db[+] [PATTERN] list tablespaces
\dc[S+] [PATTERN] list conversions
\dC[+] [PATTERN] list casts
\dd[S] [PATTERN] show object descriptions not displayed elsewhere
\ddp [PATTERN] list default privileges
\dD[S+] [PATTERN] list domains
\det[+] [PATTERN] list foreign tables
\des[+] [PATTERN] list foreign servers
\deu[+] [PATTERN] list user mappings
\dew[+] [PATTERN] list foreign-data wrappers
\df[antw][S+] [PATRN] list [only agg/normal/trigger/window] functions
Meta Comandos utiles o mas usados
Lista las bases de datos
postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
postgres | postgres | UTF8 | es_VE.UTF-8 | es_VE.UTF-8 |
pruebas | freddy | UTF8 | es_VE.UTF-8 | es_VE.UTF-8 |
template0 | postgres | UTF8 | es_VE.UTF-8 | es_VE.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | es_VE.UTF-8 | es_VE.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
(4 rows)
postgres=# \l+
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges | Size | Tablespace | Description
-----------+----------+----------+-------------+-------------+-----------------------+---------+------------+--------------------------------------------
postgres | postgres | UTF8 | es_VE.UTF-8 | es_VE.UTF-8 | | 6992 kB | pg_default | default administrative connection database
pruebas | freddy | UTF8 | es_VE.UTF-8 | es_VE.UTF-8 | | 6992 kB | pg_default |
template0 | postgres | UTF8 | es_VE.UTF-8 | es_VE.UTF-8 | =c/postgres +| 6873 kB | pg_default | unmodifiable empty database
| | | | | postgres=CTc/postgres | | |
template1 | postgres | UTF8 | es_VE.UTF-8 | es_VE.UTF-8 | =c/postgres +| 6873 kB | pg_default | default template for new databases
| | | | | postgres=CTc/postgres | | |
(4 rows)
Cambiar de base de datos
postgres=# \c pruebas
You are now connected to database "pruebas" as user "postgres".
pruebas=#
Listar todas las relaciones que tenga la base de datos
ruebas=# \d
List of relations
Schema | Name | Type | Owner
--------+-------+-------+----------
public | lista | table | postgres
(1 row)
Table "public.lista"
Column | Type | Modifiers | Storage | Stats target | Description
--------+-----------------------+-----------+----------+--------------+-------------
nombre | character varying(20) | | extended | |
pruebas=#
Ejemplo de como usar la ayuda
pruebas=# \h CREATE DATABASE
Command: CREATE DATABASE
Description: create a new database
Syntax:
CREATE DATABASE name
[ [ WITH ] [ OWNER [=] user_name ]
[ TEMPLATE [=] template ]
[ ENCODING [=] encoding ]
[ LC_COLLATE [=] lc_collate ]
[ LC_CTYPE [=] lc_ctype ]
[ TABLESPACE [=] tablespace_name ]
[ ALLOW_CONNECTIONS [=] allowconn ]
[ CONNECTION LIMIT [=] connlimit ]
[ IS_TEMPLATE [=] istemplate ] ]
Ejecutar un comando desde un Archivo
pruebas=# \i
Ejcutar comando del shell del sistema operativo que se ejcuta
pruebas=# \!
TABLESPACE
Los tablespaces son referencias a ubicaciones físicas del almacenamiento de bases de datos y/o de los objetos que éste contiene.
Es recomendable utilizar tablespaces cuando se quiere especificar ubicaciones alternativas para determinadas bases de datos o tablas, como cuando queremos que ciertas tablas estén en otros discos distintos a los que se encuentran por ejemplo, para ubicar los tablespaces con data al que se accesa muy raras veces, en dispositivos de almacenamientos lentos y a los tablespaces con data a la que constantemente se accede, en medios de almacenamiento mucho mas rápidos.
Creación del directorio para las tablespaces
sudo mkdir -p /var/midatos/miprimerbase
sudo chown -R postgres:postgres /var/midatos/
Creando el espacio de trabajo
psql -U postgres
postgres=# \h create tables
Command: CREATE TABLESPACE
Description: define a new tablespace
Syntax:
CREATE TABLESPACE tablespace_name
[ OWNER { new_owner | CURRENT_USER | SESSION_USER } ]
LOCATION 'directory'
[ WITH ( tablespace_option = value [, ... ] ) ]
Por recomendación NO SE DEBE ALMACENAR FOTOS / IMAGENES en Base de datos
- Profesor: Alexys Lozada
- https://www.youtube.com/user/Alexyslozada
- Jesús Lara
- https://phenobarbital.wordpress.com/
Estaré colando la información como anotaciones o lo que yo entiendo como buenas practicas, si alguien ve alguna mejora o corrección necesaria por favor no duden en avisarme, que la idea es tener un materia a la mano para todos.
Y como nota personal, todo lo haré sobre Linux, ya que me gusta mas trabajar con Linux que con Windows, ojo, no digo que Windows sea malo, es cuestión de gusto.
Qué es una Base de Datos?
Una base de datos es un conjunto de información organizada que cumple con un objetivo común.
Sin embargo, hablando desde el punto de vista tecnológico, estas bases de datos deben estar almacenadas de manera persistente en un medio electrónico/digital.
- Versatilidad en la representación de la información.
- Desempeño.
- Mínima Redundancia.
- Capacidad de Acceso. (Compartida y concurrente).
- Simplicidad.
- Integridad.
- Seguridad y Privacidad.
Sistema Gestor de Bases de Datos. (DBMS)
Es la herramienta de software que permite administrar una base de datos.
- Crear
- Modificar
- Poblar
- Actualizar
- Seleccionar
- Borrar
- Administrar privilegios
- MySQL
- Sql Server
- Oracle
- DB2
- Informix
- Otros
- MongoDB
- FireBase
- CouchDB
- Neo4j
- Cassandra
- Otros
Instalación de PostgreSQL (Basado en Debian)
sudo aptitude install postgresql
Conexión a postgreSQL con el cliente de consola
psql -U postgres
psql: FATAL: Peer authentication failed for user "postgres"
Para corregir el error de la conexión Peer para el usuario postgresql, se debe modificar el archivo:
sudo vim /etc/postgresql/9.5/main/pg_hba.conf
Cambiar
local all postgres peer
Por
local all postgres trust
sudo systemctl restart postgresql
Nota: Cuando se hace esto ya no presenta el error de conexión local Peer, pero esto lleva a que cualquiera que tenga acceso al equipo puede acceder a PostgreSQL
psql -U postgres
psql (9.5.4)
Type "help" for help.
postgres=# SELECT 'Hola Mundo';
?column?
------------
Hola Mundo
(1 row)
postgres=#
Por tanto seria muy recomendable cambiar la clave del ROLE postgres
postgres=# ALTER ROLE postgres PASSWORD 'SuClaveSegura';
Creación de Role
CREATE ROLE freddy LOGIN PASSWORD 'su_clave_va_aquí'
Creación de Bases de Datos
CREATE DATABASE nombre_de_la_base_de_datos OWNER dueño_de_la_db;
CREATE DATABASE pruebas OWNER freddy;
Creación de Tablas
create table nombre_de_tabla(campo tipo_de_datos(tamaño));
create table prueba(nombre varchar(200));
Insertar Datos a tablas
insert into nombre_de_tabla values('dato_a_insertar);
insert into prueba values('freddy');
Permitir acceso remoto al PostgreSQL
Se debe editar sudo postgresql.conf y cambiar:
sudo vim /etc/postgresql/9.5/main/postgresql.conf
#listen_addresses = 'localhost'
Por:
listen_addresses = '*'
sudo vim /etc/postgresql/9.5/main/pg_hba.conf
# IPv4 local connections:
host all all 0.0.0.0/0 md5
sudo systemctl restart postgresql
Meta Comando
Nos permiten realizar acciones básicas de amdnisración sobre le servidor de PostgreSQL, y siempre se debe colocar el simbolo \
Muestra una lista de todos los comando existentes
pruebas=> \?
General
\copyright show PostgreSQL usage and distribution terms
\g [FILE] or ; execute query (and send results to file or |pipe)
\gset [PREFIX] execute query and store results in psql variables
\q quit psql
\watch [SEC] execute query every SEC seconds
Help
\? [commands] show help on backslash commands
\? options show help on psql command-line options
\? variables show help on special variables
\h [NAME] help on syntax of SQL commands, * for all commands
Query Buffer
\e [FILE] [LINE] edit the query buffer (or file) with external editor
\ef [FUNCNAME [LINE]] edit function definition with external editor
\p show the contents of the query buffer
\r reset (clear) the query buffer
\s [FILE] display history or save it to file
\w FILE write query buffer to file
Input/Output
\copy ... perform SQL COPY with data stream to the client host
\echo [STRING] write string to standard output
\i FILE execute commands from file
\ir FILE as \i, but relative to location of current script
\o [FILE] send all query results to file or |pipe
\qecho [STRING] write string to query output stream (see \o)
Informational
(options: S = show system objects, + = additional detail)
\d[S+] list tables, views, and sequences
\d[S+] NAME describe table, view, sequence, or index
\da[S] [PATTERN] list aggregates
\db[+] [PATTERN] list tablespaces
\dc[S+] [PATTERN] list conversions
\dC[+] [PATTERN] list casts
\dd[S] [PATTERN] show object descriptions not displayed elsewhere
\ddp [PATTERN] list default privileges
\dD[S+] [PATTERN] list domains
\det[+] [PATTERN] list foreign tables
\des[+] [PATTERN] list foreign servers
\deu[+] [PATTERN] list user mappings
\dew[+] [PATTERN] list foreign-data wrappers
\df[antw][S+] [PATRN] list [only agg/normal/trigger/window] functions
\dF[+] [PATTERN] list text search configurations
\dFd[+] [PATTERN] list text search dictionaries
\dFp[+] [PATTERN] list text search parsers
\dFt[+] [PATTERN] list text search templates
\dg[+] [PATTERN] list roles
\di[S+] [PATTERN] list indexes
\dl list large objects, same as \lo_list
\dL[S+] [PATTERN] list procedural languages
\dm[S+] [PATTERN] list materialized views
\dn[S+] [PATTERN] list schemas
\do[S] [PATTERN] list operators
\dO[S+] [PATTERN] list collations
\dp [PATTERN] list table, view, and sequence access privileges
\drds [PATRN1 [PATRN2]] list per-database role settings
\ds[S+] [PATTERN] list sequences
\dt[S+] [PATTERN] list tables
\dT[S+] [PATTERN] list data types
\du[+] [PATTERN] list roles
\dv[S+] [PATTERN] list views
\dE[S+] [PATTERN] list foreign tables
\dx[+] [PATTERN] list extensions
\dy [PATTERN] list event triggers
\l[+] [PATTERN] list databases
\sf[+] FUNCNAME show a function's definition
\z [PATTERN] same as \dp
Formatting
\a toggle between unaligned and aligned output mode
\C [STRING] set table title, or unset if none
\f [STRING] show or set field separator for unaligned query output
\H toggle HTML output mode (currently off)
\pset [NAME [VALUE]] set table output option
(NAME := {format|border|expanded|fieldsep|fieldsep_zero|footer|null|
numericlocale|recordsep|recordsep_zero|tuples_only|title|tableattr|pager|
unicode_border_linestyle|unicode_column_linestyle|unicode_header_linestyle})
\t [on|off] show only rows (currently off)
\T [STRING] set HTML
tag attributes, or unset if none
tag attributes, or unset if none
\x [on|off|auto] toggle expanded output (currently off)
Connection
\c[onnect] {[DBNAME|- USER|- HOST|- PORT|-] | conninfo}
connect to new database (currently "pruebas")
\encoding [ENCODING] show or set client encoding
\password [USERNAME] securely change the password for a user
\conninfo display information about current connection
Operating System
\cd [DIR] change the current working directory
\setenv NAME [VALUE] set or unset environment variable
\timing [on|off] toggle timing of commands (currently off)
\! [COMMAND] execute command in shell or start interactive shell
Variables
\prompt [TEXT] NAME prompt user to set internal variable
\set [NAME [VALUE]] set internal variable, or list all if no parameters
\unset NAME unset (delete) internal variable
Large Objects
\lo_export LOBOID FILE
\lo_import FILE [COMMENT]
\lo_list
\lo_unlink LOBOID large object operations
(END)
Lista las bases de datos
postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
postgres | postgres | UTF8 | es_VE.UTF-8 | es_VE.UTF-8 |
pruebas | freddy | UTF8 | es_VE.UTF-8 | es_VE.UTF-8 |
template0 | postgres | UTF8 | es_VE.UTF-8 | es_VE.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | es_VE.UTF-8 | es_VE.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
(4 rows)
postgres=# \l+
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges | Size | Tablespace | Description
-----------+----------+----------+-------------+-------------+-----------------------+---------+------------+--------------------------------------------
postgres | postgres | UTF8 | es_VE.UTF-8 | es_VE.UTF-8 | | 6992 kB | pg_default | default administrative connection database
pruebas | freddy | UTF8 | es_VE.UTF-8 | es_VE.UTF-8 | | 6992 kB | pg_default |
template0 | postgres | UTF8 | es_VE.UTF-8 | es_VE.UTF-8 | =c/postgres +| 6873 kB | pg_default | unmodifiable empty database
| | | | | postgres=CTc/postgres | | |
template1 | postgres | UTF8 | es_VE.UTF-8 | es_VE.UTF-8 | =c/postgres +| 6873 kB | pg_default | default template for new databases
| | | | | postgres=CTc/postgres | | |
(4 rows)
Cambiar de base de datos
postgres=# \c pruebas
You are now connected to database "pruebas" as user "postgres".
pruebas=#
Listar todas las relaciones que tenga la base de datos
ruebas=# \d
List of relations
Schema | Name | Type | Owner
--------+-------+-------+----------
public | lista | table | postgres
(1 row)
Mostrar Estructura de la Tabla
pruebas=# \d+ listaTable "public.lista"
Column | Type | Modifiers | Storage | Stats target | Description
--------+-----------------------+-----------+----------+--------------+-------------
nombre | character varying(20) | | extended | |
pruebas=#
Buscar ayuda del SQL
pruebas=# \h
SCHEMA | DROP | LANGUAGE | MOVE | |||||||
CREATE | SEQUENCE | DROP | MATERIALIZED | VIEW | NOTIFY | |||||
MAPPING | CREATE | SERVER | DROP | OPERATOR | PREPARE | |||||
CREATE | TABLE | DROP | OPERATOR | CLASS | PREPARE | TRANSACTION | ||||
TABLE | AS | DROP | OPERATOR | FAMILY | REASSIGN | OWNED | ||||
CREATE | TABLESPACE | DROP | OWNED | REFRESH | MATERIALIZED | VIEW | ||||
TEXT | SEARCH | CONFIGURATION | DROP | POLICY | REINDEX | |||||
CREATE | TEXT | SEARCH | DICTIONARY | DROP | ROLE | RELEASE | SAVEPOINT | |||
TEXT | SEARCH | PARSER | DROP | RULE | RESET | |||||
COMMENT | CREATE | TEXT | SEARCH | TEMPLATE | DROP | SCHEMA | REVOKE | |||
CREATE | TRANSFORM | DROP | SEQUENCE | ROLLBACK | ||||||
CREATE | TRIGGER | DROP | SERVER | ROLLBACK | PREPARED | |||||
TYPE | DROP | TABLE | ROLLBACK | TO | SAVEPOINT | |||||
CREATE | USER | DROP | TABLESPACE | SAVEPOINT | ||||||
CREATE | USER | MAPPING | DROP | TEXT | SEARCH | CONFIGURATION | SECURITY | LABEL | ||
COLLATION | CREATE | VIEW | DROP | TEXT | SEARCH | DICTIONARY | SELECT | |||
CONVERSION | DEALLOCATE | DROP | TEXT | SEARCH | PARSER | SELECT | INTO | |||
DECLARE | DROP | TEXT | SEARCH | TEMPLATE | SET | |||||
DOMAIN | DELETE | DROP | TRANSFORM | SET | CONSTRAINTS | |||||
EVENT | TRIGGER | DISCARD | DROP | TRIGGER | SET | ROLE | ||||
DO | DROP | TYPE | SET | SESSION | AUTHORIZATION | |||||
DATA | WRAPPER | DROP | AGGREGATE | DROP | USER | SET | TRANSACTION | |||
TABLE | DROP | CAST | DROP | USER | MAPPING | SHOW | ||||
DROP | COLLATION | DROP | VIEW | START | TRANSACTION | |||||
DROP | CONVERSION | END | TABLE | |||||||
DROP | DATABASE | EXECUTE | TRUNCATE | |||||||
DROP | DOMAIN | EXPLAIN | UNLISTEN | |||||||
VIEW | DROP | EVENT | TRIGGER | FETCH | UPDATE | |||||
DROP | EXTENSION | GRANT | VACUUM | |||||||
CREATE | OPERATOR | CLASS | DROP | FOREIGN | DATA | WRAPPER | IMPORT | FOREIGN | SCHEMA | VALUES |
CREATE | OPERATOR | FAMILY | DROP | FOREIGN | TABLE | INSERT | WITH | |||
CREATE | POLICY | DROP | FUNCTION | LISTEN | ||||||
CREATE | ROLE | DROP | GROUP | LOAD | ||||||
DROP | INDEX | LOCK | ||||||||
pruebas=# \h CREATE DATABASE
Command: CREATE DATABASE
Description: create a new database
Syntax:
CREATE DATABASE name
[ [ WITH ] [ OWNER [=] user_name ]
[ TEMPLATE [=] template ]
[ ENCODING [=] encoding ]
[ LC_COLLATE [=] lc_collate ]
[ LC_CTYPE [=] lc_ctype ]
[ TABLESPACE [=] tablespace_name ]
[ ALLOW_CONNECTIONS [=] allowconn ]
[ CONNECTION LIMIT [=] connlimit ]
[ IS_TEMPLATE [=] istemplate ] ]
Ejecutar un comando desde un Archivo
pruebas=# \i
Ejcutar comando del shell del sistema operativo que se ejcuta
pruebas=# \!
TABLESPACE
Los tablespaces son referencias a ubicaciones físicas del almacenamiento de bases de datos y/o de los objetos que éste contiene.
Es recomendable utilizar tablespaces cuando se quiere especificar ubicaciones alternativas para determinadas bases de datos o tablas, como cuando queremos que ciertas tablas estén en otros discos distintos a los que se encuentran por ejemplo, para ubicar los tablespaces con data al que se accesa muy raras veces, en dispositivos de almacenamientos lentos y a los tablespaces con data a la que constantemente se accede, en medios de almacenamiento mucho mas rápidos.
Creación del directorio para las tablespaces
sudo mkdir -p /var/midatos/miprimerbase
sudo chown -R postgres:postgres /var/midatos/
Creando el espacio de trabajo
psql -U postgres
postgres=# \h create tables
Command: CREATE TABLESPACE
Description: define a new tablespace
Syntax:
CREATE TABLESPACE tablespace_name
[ OWNER { new_owner | CURRENT_USER | SESSION_USER } ]
LOCATION 'directory'
[ WITH ( tablespace_option = value [, ... ] ) ]
CREATE TABLESPACE tbl_misdatos LOCATION '/var/midatos/miprimerbase';
Crear un Base de datos y en el tablespace generado
ostgres=# \h create database
Command: CREATE DATABASE
Description: create a new database
Syntax:
CREATE DATABASE name
[ [ WITH ] [ OWNER [=] user_name ]
[ TEMPLATE [=] template ]
[ ENCODING [=] encoding ]
[ LC_COLLATE [=] lc_collate ]
[ LC_CTYPE [=] lc_ctype ]
[ TABLESPACE [=] tablespace_name ]
[ ALLOW_CONNECTIONS [=] allowconn ]
[ CONNECTION LIMIT [=] connlimit ]
[ IS_TEMPLATE [=] istemplate ] ]
postgres=# CREATE DATABASE clsedos TABLESPACE = tbl_misdatos;
Tipos de Datos (solo algunos)
Chapter 8. Data Types
https://www.postgresql.org/docs/9.5/static/datatype.html
Chapter 8. Data Types
https://www.postgresql.org/docs/9.5/static/datatype.html
Conocer y entender los tipos de datos que manejan las bases de datos relaciones nos permite tener una idea de la cantidad de espacio que se debe reservar para almacenar la información.
Para guardar precios se recomienda el tipo de datos real
Por recomendación NO SE DEBE ALMACENAR FOTOS / IMAGENES en Base de datos
Funciones
postgres=# SELECT char_length('Hola Mundo');
char_length
-------------
10
postgres=# SELECT NOW();
now
-------------------------------
2016-10-23 18:11:52.941174-04
(1 row)
Comentarios
Publicar un comentario