Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

240
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!