Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

247
Visualizações
Adding standard metadata to a table - Postgresql

I worked with the ESRI geodb where you can insert (into the "property" of a table) some metadata (also compliant to some International standard), like creation date, organization, source, copyright info etc.

Is there something similar in Postgres, for metadata of a table as a whole? I know only COMMENT but it seems too poor for my purposes.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Here is a very naive example of how you can save your wanted "metadata"

lest assume you have two tables you want to have data about:

t=# create table so66(i int, t text);
CREATE TABLE
Time: 5.431 ms
t=# create table so67(i int, t text);
CREATE TABLE
Time: 4.797 ms

and a "metadata" holder table:

t=# create table metadata(tname text, created timestamptz, details json);
CREATE TABLE
Time: 6.814 ms
t=# insert into metadata select 'so66',now(),'{"organization":"n/a","source":"manual","catalog":false}';
INSERT 0 1
Time: 3.144 ms
t=# insert into metadata select 'so76',now(),'{"organization":"home","source":"manual","catalog":true}';
INSERT 0 1
Time: 0.907 ms

t=# select * from metadata ;
 tname |            created            |                         details
-------+-------------------------------+----------------------------------------------------------
 so66  | 2017-04-21 09:24:08.233346+00 | {"organization":"n/a","source":"manual","catalog":false}
 so76  | 2017-04-21 09:24:26.641526+00 | {"organization":"home","source":"manual","catalog":true}
(2 rows)

Time: 0.253 ms

I used json to save arbitrary details. Of course you can add columns with special data types for your needs. Also you might want to use oids instead of table names or do some logic on insert/update of it.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda