Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save juelvaldivia/15f90280a86997faca1cf5997ff0a683 to your computer and use it in GitHub Desktop.
Save juelvaldivia/15f90280a86997faca1cf5997ff0a683 to your computer and use it in GitHub Desktop.
SELECT
t1.TABLE_NAME AS tabla_nombre,
t1.COLUMN_NAME AS columna_nombre,
t1.COLUMN_DEFAULT AS columna_defecto,
t1.IS_NULLABLE AS columna_nulo,
t1.DATA_TYPE AS columna_tipo_dato,
COALESCE(t1.NUMERIC_PRECISION,
t1.CHARACTER_MAXIMUM_LENGTH) AS columna_longitud,
PG_CATALOG.COL_DESCRIPTION(t2.OID,
t1.DTD_IDENTIFIER::int) AS columna_descripcion,
t1.DOMAIN_NAME AS columna_dominio
FROM
INFORMATION_SCHEMA.COLUMNS t1
INNER JOIN PG_CLASS t2 ON (t2.RELNAME = t1.TABLE_NAME)
WHERE
t1.TABLE_SCHEMA = 'public'
ORDER BY
t1.TABLE_NAME;
@alandalegend
Copy link

Gracias, funcionó sin problemas.

Eres crack

@maursam
Copy link

maursam commented Aug 18, 2020

Excelente, funcionó perfecto.
gracias.

@jzapata1594
Copy link

Muchas gracias.

@DaniloAndress
Copy link

Perfecto, gracias!

@cvargas
Copy link

cvargas commented Mar 31, 2021

Muy bien, Gracias!

@cvargas
Copy link

cvargas commented Mar 31, 2021

Añadi esto

ORDER BY
t1.TABLE_NAME, t1.ordinal_position;

@Locons
Copy link

Locons commented Aug 27, 2022

Gracias!

@jarmenta-extreme
Copy link

Muchas Gracias me fue de utilidad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment