sql >> Databáze >  >> RDS >> PostgreSQL

Je modul Ltree PostgreSQL vhodný pro komentáře ve vláknech?

  1. Ano a ano;
  2. Hierarchie sekcí ve znalostní bázi (jedna z implementací);
  3. Ano;

Definice jedné z příslušných tabulek:

                                                   Table "knowledgebase.section"
           Column           |           Type           |                                  Modifiers
----------------------------+--------------------------+-----------------------------------------------------------------------------
 section_sid                | integer                  | not null default nextval('knowledgebase.section_section_sid_seq'::regclass)
 section                    | character varying        | not null
 description                | character varying        |
 path                       | ltree                    | not null
 is_active                  | boolean                  | not null default true
 role_sid                   | integer                  | not null
 last_modified_by           | integer                  | not null
 creation_datetime          | timestamp with time zone | not null default now()
 last_modification_datetime | timestamp with time zone | not null default now()
 is_expanded                | boolean                  | not null default false
 section_idx                | tsvector                 |
Indexes:
    "section_sid_pkey" PRIMARY KEY, btree (section_sid)
    "section_section_key" UNIQUE, btree (section)
    "idxsection_idx" gist (section_idx)
    "path_gist_idx" gist (path)
Foreign-key constraints:
    "last_modified_by_fkey" FOREIGN KEY (last_modified_by) REFERENCES "user"."role"(role_sid) ON UPDATE CASCADE ON DELETE RESTRICT
    "role_sid_fkey" FOREIGN KEY (role_sid) REFERENCES "user"."role"(role_sid) ON  UPDATE CASCADE ON DELETE RESTRICT
Triggers:
    section_idx_update BEFORE INSERT OR UPDATE ON knowledgebase.section FOR EACH ROW EXECUTE PROCEDURE tsearch2('section_idx', 'section')

Sloupec "cesta" používá primární klíč jako popisek.

Ukázka aktuálního obsahu této tabulky (s ohledem na primární klíč a sloupec "cesta"):

  section_sid | path
 -------------+-------
           53 | 34.53
           56 | 56
           55 | 29.55
           35 | 35
           54 | 34.54
           37 | 30.37
          ... | ...


  1. Nelze exportovat tabulku AWS RDS Postgres do CSV v S3 pomocí funkce aws_s3.query_export_to_s3

  2. Je v Oracle užitečné spuštění klauzule WHERE dotazu SQL s 1=1?

  3. Jak mohu zvýšit sloupec o jeden ve spouštěči?

  4. SQL Trigger for View