This file is indexed.

/usr/share/libgda-5.0/information_schema.xml is in libgda-5.0-common 5.2.2-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
<?xml version="1.0" encoding="UTF-8"?>
<!--
    Information schema for Libgda's dictionary DB.
    This is the base schema and can be extended by applications by adding new
    DBMS objects, but: the '_' prefix is reserved for Libgda's internals...

    IMPORTANT NOTE: when modified, please:
    * run tools/information-schema-doc and move the generated file to doc/C/
    * run tools/information-schema-types and move the generated file to libgda/providers-support/
    * increment the CURRENT_SCHEMA_VERSION define in libgda/gda-meta-store.c and implement the corresponding
      schema migration in that file
-->


<schema>
  <!-- provider specific information 
       use <replace> to replace something with something else (context can only be "/FIELDS_A/@COLUMN_TYPE" at the moment)
       use <ignore> to ignore some parts (context can only be "/FKEY_S" or "/FIELDS_A/@COLUMN_PKEY" at the moment)
    -->
  <specifics>
    <provider name="PostgreSQL">
      <replace context="/FIELDS_A/@COLUMN_TYPE" expr="string" replace_with="varchar"/>
      <replace context="/FIELDS_A/@COLUMN_TYPE" expr="gint" replace_with="int"/>
    </provider>
    <provider name="MySQL">
      <replace context="/FIELDS_A/@COLUMN_TYPE" expr="string" replace_with="varchar (30)"/>
      <replace context="/FIELDS_A/@COLUMN_TYPE" expr="gint" replace_with="int"/>
      <ignore context="/FKEY_S"/>
      <ignore context="/FIELDS_A/@COLUMN_PKEY"/>
    </provider>
    <provider name="SQLite">
      <replace context="/FIELDS_A/@COLUMN_TYPE" expr="gint" replace_with="int"/>
    </provider>
  </specifics>

  <!-- schema description -->
  <table name="_attributes" descr="Table to store (key,value) pairs (keys starting with '_' are reserved)">
    <column name="att_name" pkey="TRUE"/>
    <column name="att_value"/>
  </table>

  <table name="_information_schema_catalog_name" descr="Name of the current database (current catalog), has only one row">
    <column name="catalog_name" pkey="TRUE" ident="TRUE"/>
  </table>

  <table name="_schemata" descr="List of schemas">
    <column name="catalog_name" pkey="TRUE" ident="TRUE" descr="Name of the catalog that contains the schema"/>
    <column name="schema_name" pkey="TRUE" ident="TRUE"/>
    <column name="schema_owner" nullok="TRUE" descr="Name of the schema"/>
    <column name="schema_internal" type="boolean"  descr="Tells if the schema is specific to the database implementation (and usually can't be modified)"/>
    <column name="schema_default" nullok="TRUE" type="boolean"  descr="Tells if the schema is used by default when creating a new table without schema name"/>
    <fkey ref_table="_information_schema_catalog_name">
      <part column="catalog_name" ref_column="catalog_name"/>
    </fkey>
  </table>

  <table name="_builtin_data_types" descr="List of built-in data types such as varchar, int, ...">
    <column name="short_type_name" descr="Short name of the data type"/>
    <column name="full_type_name" pkey="TRUE" descr="Full name of the data type"/>
    <column name="gtype" nullok="TRUE"/>
    <column name="comments" nullok="TRUE"/>
    <column name="synonyms" nullok="TRUE"/>
    <column name="internal" type="boolean" descr="Tells if the data type is reserved for the database implementation and should not be used in applications"/>
    <unique>
      <column name="short_type_name"/>
    </unique>
  </table>

  <table name="_udt" descr="User defined data types">
    <column name="udt_catalog" pkey="TRUE" ident="TRUE" descr="Name of the catalog that contains the data type"/>
    <column name="udt_schema" pkey="TRUE" descr="Name of the schema that contains the data type" ident="TRUE"/>
    <column name="udt_name" pkey="TRUE" descr="Name of the data type" ident="TRUE"/>
    <column name="udt_gtype" nullok="TRUE" descr="GType associated to the data type"/>
    <column name="udt_comments" nullok="TRUE"/>
    <column name="udt_short_name" ident="TRUE"/>
    <column name="udt_full_name" ident="TRUE"/>
    <column name="udt_internal" type="boolean" descr="Tells if the data type is reserved for the database implementation and should not be used in applications"/>
    <column name="udt_owner" nullok="TRUE"/>
    <fkey ref_table="_schemata">
      <part column="udt_catalog" ref_column="catalog_name"/>
      <part column="udt_schema" ref_column="schema_name"/>
    </fkey>
    <unique>
      <column name="udt_full_name"/>
    </unique>
  </table>

  <table name="_udt_columns" descr="List of components for a user defined data type for composed data types (such as a complex number data type which has real and imaginary parts)">
    <column name="udt_catalog" pkey="TRUE" descr="Name of the catalog that contains the user defined data type for which the column is" ident="TRUE"/>
    <column name="udt_schema" pkey="TRUE" descr="Name of the schema that contains the user defined data type for which the column is" ident="TRUE"/>
    <column name="udt_name" pkey="TRUE" descr="Name of the user defined data type for which the column is" ident="TRUE"/>
    <column name="udt_column" pkey="TRUE" descr="Name of the column (part)" ident="TRUE"/>
    <column name="ordinal_position" type="gint" descr="Column position, starts at 1"/>
    <column name="data_type" nullok="TRUE" descr="Data type of the column (if the column is an array, then 'array_spec' is set, and this may be NULL)"/>
    <column name="array_spec" nullok="TRUE" descr="Array description if the column is an array"/>
    <column name="character_maximum_length" type="gint" nullok="TRUE"/>
    <column name="character_octet_length" type="gint" nullok="TRUE"/>
    <column name="numeric_precision" type="gint" nullok="TRUE"/>
    <column name="numeric_scale" type="gint" nullok="TRUE"/>
    <column name="datetime_precision" type="gint" nullok="TRUE"/>
    <column name="character_set_catalog" nullok="TRUE"/>
    <column name="character_set_schema" nullok="TRUE" ident="TRUE"/>
    <column name="character_set_name" nullok="TRUE" ident="TRUE"/>
    <column name="collation_catalog" nullok="TRUE"/>
    <column name="collation_schema" nullok="TRUE" ident="TRUE"/>
    <column name="collation_name" nullok="TRUE" ident="TRUE"/>
    <fkey ref_table="_udt">
      <part column="udt_catalog"/>
      <part column="udt_schema"/>
      <part column="udt_name"/>
    </fkey>
    <fkey ref_table="_element_types">
      <part column="array_spec" ref_column="specific_name"/>
    </fkey>
    <!--
    <fkey ref_table="_all_types">
      <part column="data_type" ref_column="full_type_name"/>
    </fkey>
    -->
  </table>

  <table name="_enums" descr="List of possible enumeration labels for enumerations">
    <column name="udt_catalog" pkey="TRUE" descr="Name of the catalog that contains the ENUM user defined data type" ident="TRUE"/>
    <column name="udt_schema" pkey="TRUE" descr="Name of the schema that contains the ENUM user defined data type" ident="TRUE"/>
    <column name="udt_name" pkey="TRUE" descr="Name of the ENUM user defined data type" ident="TRUE"/>
    <column name="label" pkey="TRUE"/>
    <column name="ordinal_position" type="gint" descr="Position, starts at 1"/>
    <fkey ref_table="_udt">
      <part column="udt_catalog"/>
      <part column="udt_schema"/>
      <part column="udt_name"/>
    </fkey>
  </table>

  <table name="_element_types" descr="Array specific attributes for array data types">
    <column name="specific_name" pkey="TRUE" descr="No specific meaning, used as a primary key, and for joining"/>
    <column name="object_catalog" descr="Name of the catalog that contains the object that uses the array being described" ident="TRUE"/>
    <column name="object_schema" descr="Name of the schema that contains the object that uses the array being described" ident="TRUE"/>
    <column name="object_name" descr="Name of the object that uses the array being described" ident="TRUE"/>
    <column name="object_type" descr="The type of the object that uses the array being described TABLE_COL, DOMAIN, UDT_COL, ROUTINE_COL, ROUTINE_PAR"/>
    <column name="data_type" nullok="TRUE" descr="Base data type of the array (if the base data type is an array, then 'array_spec' is set, and this may be NULL)"/>
    <column name="array_spec" nullok="TRUE" descr="Array description if the base data type is an array"/>
    <column name="min_cardinality" type="gint" nullok="TRUE"/>
    <column name="max_cardinality" type="gint" nullok="TRUE"/>
  </table>

  <table name="_domains" descr="List of domains">
    <column name="domain_catalog" pkey="TRUE" descr="Name of catalog that contains the domain" ident="TRUE"/>
    <column name="domain_schema" pkey="TRUE" descr="Name of schema that contains the domain" ident="TRUE"/>
    <column name="domain_name" pkey="TRUE" descr="Name of the domain" ident="TRUE"/>
    <column name="data_type" nullok="TRUE" descr="Data type of the domain (if the domain is an array, then 'array_spec' is set, and this may be NULL)"/>
    <column name="array_spec" nullok="TRUE" descr="Array description if the domain is an array"/>
    <column name="domain_gtype"/>
    <column name="character_maximum_length" type="gint" nullok="TRUE"/>
    <column name="character_octet_length" type="gint" nullok="TRUE"/>
    <column name="collation_catalog" nullok="TRUE" descr="Name of catalog that contains the associated collation" ident="TRUE"/>
    <column name="collation_schema" nullok="TRUE" descr="Name of schema that contains the associated collation" ident="TRUE"/>
    <column name="collation_name" nullok="TRUE" descr="Name of the associated collation" ident="TRUE"/>
    <column name="character_set_catalog" nullok="TRUE" descr="Name of catalog that contains the associated character set" ident="TRUE"/>
    <column name="character_set_schema" nullok="TRUE" descr="Name of schema that contains the associated character set" ident="TRUE"/>
    <column name="character_set_name" nullok="TRUE" descr="Name of the associated character set" ident="TRUE"/>
    <column name="numeric_precision" type="gint" nullok="TRUE"/>
    <column name="numeric_scale" type="gint" nullok="TRUE"/>
    <column name="domain_default" nullok="TRUE"/>
    <column name="domain_comments" nullok="TRUE"/>
    <column name="domain_short_name" ident="TRUE"/>
    <column name="domain_full_name" ident="TRUE"/>
    <column name="domain_internal" type="boolean"/>
    <column name="domain_owner" nullok="TRUE"/>
    <fkey ref_table="_schemata">
      <part column="domain_catalog" ref_column="catalog_name"/>
      <part column="domain_schema" ref_column="schema_name"/>
    </fkey>
    <fkey ref_table="_element_types">
      <part column="array_spec" ref_column="specific_name"/>
    </fkey>
    <!--
    <fkey ref_table="_all_types">
      <part column="data_type" ref_column="full_type_name"/>
    </fkey>
    -->
    <unique>
      <column name="domain_full_name"/>
    </unique>
  </table>

  <table name="_tables" descr="List of tables (tables, views or other objects which can contain data)">
    <column name="table_catalog" pkey="TRUE" descr="Name of catalog that contains the table" ident="TRUE"/>
    <column name="table_schema" pkey="TRUE" descr="Name of schema that contains the table" ident="TRUE"/>
    <column name="table_name" pkey="TRUE" descr="Name of the table" ident="TRUE"/>
    <column name="table_type" descr="Type of table: BASE TABLE, VIEW, LOCAL TEMPORARY, SYSTEM TABLE, GLOBAL TEMPORARY, ALIAS or SYNONYM"/>
    <column name="is_insertable_into" type="boolean" nullok="TRUE" descr="Tells if the table's contents can be modified"/>
    <column name="table_comments" nullok="TRUE"/>
    <column name="table_short_name" ident="TRUE"/>
    <column name="table_full_name" ident="TRUE"/>
    <column name="table_owner" nullok="TRUE"/>
    <fkey ref_table="_schemata">
      <part column="table_catalog" ref_column="catalog_name"/>
      <part column="table_schema" ref_column="schema_name"/>
    </fkey>
    <unique>
      <column name="domain_full_name"/>
    </unique>
  </table>

  <table name="_views" descr="List of views and their specific information">
    <column name="table_catalog" pkey="TRUE" descr="Name of catalog that contains the view" ident="TRUE"/>
    <column name="table_schema" pkey="TRUE" descr="Name of schema that contains the view" ident="TRUE"/>
    <column name="table_name" pkey="TRUE" descr="Name of the view" ident="TRUE"/>
    <column name="view_definition" nullok="TRUE" descr="View as SQL"/>
    <column name="check_option" nullok="TRUE" descr="CASCADE if the statement used to create the view included the WITH CHECK OPTION; otherwise, NONE"/>
    <column name="is_updatable" type="boolean" nullok="TRUE" descr="Tells if the view's contents can be modified"/>
    <fkey ref_table="_tables">
      <part column="table_catalog"/>
      <part column="table_schema"/>
      <part column="table_name"/>
    </fkey>
  </table>

  <table name="_collations" descr="List of collations methods">
    <column name="collation_catalog" pkey="TRUE" ident="TRUE"/>
    <column name="collation_schema" pkey="TRUE" ident="TRUE"/>
    <column name="collation_name" pkey="TRUE" ident="TRUE"/>
    <column name="collation_comments" nullok="TRUE"/>
    <column name="collation_short_name" ident="TRUE"/>
    <column name="collation_full_name" ident="TRUE"/>
    <fkey ref_table="_schemata">
      <part column="collation_catalog" ref_column="catalog_name"/>
      <part column="collation_schema" ref_column="schema_name"/>
    </fkey>
    <unique>
      <column name="collation_full_name"/>
    </unique>
  </table>

  <table name="_character_sets" descr="List of character sets">
    <column name="character_set_catalog" pkey="TRUE" ident="TRUE"/>
    <column name="character_set_schema" pkey="TRUE" ident="TRUE"/>
    <column name="character_set_name" pkey="TRUE" ident="TRUE"/>
    <column name="default_collate_catalog" nullok="TRUE"/>
    <column name="default_collate_schema" nullok="TRUE" ident="TRUE"/>
    <column name="default_collate_name" nullok="TRUE" ident="TRUE"/>
    <column name="character_set_comments" nullok="TRUE"/>
    <column name="character_set_short_name" ident="TRUE"/>
    <column name="character_set_full_name" ident="TRUE"/>
    <fkey ref_table="_schemata">
      <part column="character_set_catalog" ref_column="catalog_name"/>
      <part column="character_set_schema" ref_column="schema_name"/>
    </fkey>
    <fkey ref_table="_collations">
      <part column="default_collate_catalog" ref_column="collation_catalog"/>
      <part column="default_collate_schema" ref_column="collation_schema"/>
      <part column="default_collate_name" ref_column="collation_name"/>
    </fkey>
    <unique>
      <column name="character_set_full_name"/>
    </unique>
  </table>

  <table name="_routines" descr="List of functions and stored procedures (note: the primary jey for that table is composed of (specific_catalog, specific_schema, specific_name))">
    <column name="specific_catalog" pkey="TRUE" descr="Specific name of catalog that contains the routine" ident="TRUE"/>
    <column name="specific_schema" pkey="TRUE" descr="Specific name of schema that contains the routine" ident="TRUE"/>
    <column name="specific_name" pkey="TRUE" descr="Specific name of the routine (may be mangled for polymorphic routines)"/>
    <column name="routine_catalog" nullok="TRUE" descr="Name of catalog that contains the routine (may be NULL)"/>
    <column name="routine_schema" nullok="TRUE" descr="Name of schema that contains the routine (may be NULL)" ident="TRUE"/>
    <column name="routine_name" descr="Name of the routine" ident="TRUE"/>
    <column name="routine_type" nullok="TRUE" descr="FUNCTION, PROCEDURE, AGGREGATE"/>
    <column name="return_type" nullok="TRUE" descr="Data type returned by the routine (may be NULL if routine does not return any value)"/>
    <column name="returns_set" type="boolean" descr="True if routine returns a set (i.e., multiple values of the specified data type or if data type may vary)"/>
    <column name="nb_args" type="gint" descr="Number of arguments (-1 for variable number of arguments)"/>
    <column name="routine_body" nullok="TRUE" descr="If the routine is an SQL function, then SQL, else EXTERNAL"/>
    <column name="routine_definition" nullok="TRUE" descr="The source text of the routine"/>
    <column name="external_name" nullok="TRUE" descr="If the routine is an external function, then the external name (link symbol) of the function"/>
    <column name="external_language" nullok="TRUE" descr="The language the routine is written in"/>
    <column name="parameter_style" nullok="TRUE" descr="Parameter style (GENERAL, JAVA, SQL, GENERAL WITH NULLS)"/>
    <column name="is_deterministic" type="boolean" nullok="TRUE" descr="Tells if the routine returns the same results given the same arguments forever"/>
    <column name="sql_data_access" nullok="TRUE" descr="Whether the routine contains SQL and whether it reads or modifies data (NONE, CONTAINS, READS, MODIFIES)"/>
    <column name="is_null_call" type="boolean" nullok="TRUE" descr="Tells if the routine will be called if any one of its arguments is NULL"/>
    <column name="routine_comments" nullok="TRUE"/>
    <column name="routine_short_name" ident="TRUE"/>
    <column name="routine_full_name" ident="TRUE"/>
    <column name="routine_owner" nullok="TRUE"/>
    <fkey ref_table="_schemata">
      <part column="specific_catalog" ref_column="catalog_name"/>
      <part column="specific_schema" ref_column="schema_name"/>
    </fkey>
    <unique>
      <column name="routine_full_name"/>
    </unique>
  </table>

  <table name="_triggers" descr="List of triggers">
    <column name="trigger_catalog" pkey="TRUE" ident="TRUE"/>
    <column name="trigger_schema" pkey="TRUE" ident="TRUE"/>
    <column name="trigger_name" pkey="TRUE" ident="TRUE"/>
    <column name="event_manipulation" pkey="TRUE" descr="Event that fires the trigger (INSERT, UPDATE, or DELETE)"/>
    <column name="event_object_catalog" pkey="TRUE" descr="Name of the database that contains the table that the trigger is defined on" ident="TRUE"/>
    <column name="event_object_schema" pkey="TRUE" descr="Name of the schema that contains the table that the trigger is defined on" ident="TRUE"/>
    <column name="event_object_table" pkey="TRUE" descr="Name of the table that the trigger is defined on" ident="TRUE"/>

    <column name="action_statement" nullok="TRUE" descr="Statement that is executed by the trigger"/>
    <column name="action_orientation" descr="Identifies whether the trigger fires once for each processed row or once for each statement (ROW or STATEMENT)"/>
    <column name="condition_timing" descr="Time at which the trigger fires (BEFORE or AFTER)"/>
    <column name="trigger_comments" nullok="TRUE"/>
    <column name="trigger_short_name" ident="TRUE"/>
    <column name="trigger_full_name" ident="TRUE"/>
    <fkey ref_table="_schemata">
      <part column="trigger_catalog" ref_column="catalog_name"/>
      <part column="trigger_schema" ref_column="schema_name"/>
    </fkey>
    <fkey ref_table="_tables">
      <part column="event_object_catalog" ref_column="table_catalog"/>
      <part column="event_object_schema" ref_column="table_schema"/>
      <part column="event_object_table" ref_column="table_name"/>
    </fkey>
    <unique>
      <column name="trigger_full_name"/>
    </unique>
  </table>

  <table name="_columns" descr="List of columns composing tables">
    <column name="table_catalog" pkey="TRUE" ident="TRUE"/>
    <column name="table_schema" pkey="TRUE" ident="TRUE"/>
    <column name="table_name" pkey="TRUE" ident="TRUE"/>
    <column name="column_name" pkey="TRUE" ident="TRUE"/>
    <column name="ordinal_position" type="gint" descr="Column position, starts at 1"/>
    <column name="column_default" nullok="TRUE"/>
    <column name="is_nullable" type="boolean"/>
    <column name="data_type" nullok="TRUE" descr="Data type of the column (if the column is an array, then 'array_spec' is set, and this may be NULL)"/>
    <column name="array_spec" nullok="TRUE" descr="Array description if the column is an array"/>
    <column name="gtype"/>
    <column name="character_maximum_length" type="gint" nullok="TRUE"/>
    <column name="character_octet_length" type="gint" nullok="TRUE"/>
    <column name="numeric_precision" type="gint" nullok="TRUE" descr="If data_type identifies a numeric type, this column contains the precision of the type for this column (the number of significant digits)"/>
    <column name="numeric_scale" type="gint" nullok="TRUE" descr="If data_type identifies an exact numeric type, this column contains the scale of the type for this column (the number of significant digits to the right of the decimal point)"/>
    <column name="datetime_precision" type="gint" nullok="TRUE"/>
    <column name="character_set_catalog" nullok="TRUE" ident="TRUE"/>
    <column name="character_set_schema" nullok="TRUE" ident="TRUE"/>
    <column name="character_set_name" nullok="TRUE" ident="TRUE"/>
    <column name="collation_catalog" nullok="TRUE" ident="TRUE"/>
    <column name="collation_schema" nullok="TRUE" ident="TRUE"/>
    <column name="collation_name" nullok="TRUE" ident="TRUE"/>
    <column name="extra" nullok="TRUE" descr="CSV string with: AUTO_INCREMENT"/> <!-- set the gda-enums.h file -->
    <column name="is_updatable" type="boolean" nullok="TRUE"/>
    <column name="column_comments" nullok="TRUE"/>
    <fkey ref_table="_tables">
      <part column="table_catalog"/>
      <part column="table_schema"/>
      <part column="table_name"/>
    </fkey>
    <fkey ref_table="_character_sets">
      <part column="character_set_catalog"/>
      <part column="character_set_schema"/>
      <part column="character_set_name"/>
    </fkey>
    <fkey ref_table="_collations">
      <part column="collation_catalog"/>
      <part column="collation_schema"/>
      <part column="collation_name"/>
    </fkey>
    <fkey ref_table="_element_types">
      <part column="array_spec" ref_column="specific_name"/>
    </fkey>
    <!--
    <fkey ref_table="_all_types">
      <part column="data_type" ref_column="full_type_name"/>
    </fkey>
    -->
  </table>

  <table name="_table_constraints" descr="List of constraints applied to tables (Check, primary or foreign key, or unique constraints)">
    <column name="constraint_catalog" nullok="TRUE" descr="Name of the catalog that contains the constraint" ident="TRUE"/>
    <column name="constraint_schema" nullok="TRUE" descr="Name of the schema that contains the constraint" ident="TRUE"/>

    <column name="constraint_name" pkey="TRUE" ident="TRUE"/>
    <column name="table_catalog" pkey="TRUE" ident="TRUE"/>
    <column name="table_schema" pkey="TRUE" ident="TRUE"/>
    <column name="table_name" pkey="TRUE" ident="TRUE"/>
    <column name="constraint_type" descr="CHECK, FOREIGN KEY, PRIMARY KEY or UNIQUE"/>
    <column name="check_clause" nullok="TRUE" descr="The check expression if the constraint is a check constraint, NULL otherwise"/>
    <column name="is_deferrable" type="boolean" nullok="TRUE"/>
    <column name="initially_deferred" type="boolean" nullok="TRUE"/>
    <fkey ref_table="_tables">
      <part column="table_catalog"/>
      <part column="table_schema"/>
      <part column="table_name"/>
    </fkey>
  </table>

  <table name="_referential_constraints" descr="List of foreign key constraints, along with some specific attributes">
    <column name="table_catalog" pkey="TRUE" ident="TRUE"/>
    <column name="table_schema" pkey="TRUE" ident="TRUE"/>
    <column name="table_name" pkey="TRUE" ident="TRUE"/>
    <column name="constraint_name" pkey="TRUE" ident="TRUE"/>

    <column name="ref_table_catalog" ident="TRUE"/>
    <column name="ref_table_schema" ident="TRUE"/>
    <column name="ref_table_name" ident="TRUE"/>
    <column name="ref_constraint_name" ident="TRUE"/>

    <column name="match_option" nullok="TRUE" descr="FULL, PARTIAL or NONE"/>
    <column name="update_rule" nullok="TRUE" descr="CASCADE, SET NULL, SET DEFAULT, RESTRICT, NO ACTION or NONE"/>
    <column name="delete_rule" nullok="TRUE" descr="CASCADE, SET NULL, SET DEFAULT, RESTRICT, NO ACTION or NONE"/>
    <fkey ref_table="_table_constraints">
      <part column="table_catalog"/>
      <part column="table_schema"/>
      <part column="table_name"/>
      <part column="constraint_name"/>
    </fkey>
    <fkey ref_table="_table_constraints">
      <part column="ref_table_catalog" ref_column="table_catalog"/>
      <part column="ref_table_schema" ref_column="table_schema"/>
      <part column="ref_table_name" ref_column="table_name"/>
      <part column="ref_constraint_name" ref_column="constraint_name"/>
    </fkey>
  </table>

  <table name="_key_column_usage" descr="List of primary key constraints and the name of the tables' columns involved">
    <column name="table_catalog" pkey="TRUE" ident="TRUE"/>
    <column name="table_schema" pkey="TRUE" ident="TRUE"/>
    <column name="table_name" pkey="TRUE" ident="TRUE"/>
    <column name="constraint_name" pkey="TRUE" ident="TRUE"/>
    <column name="column_name" pkey="TRUE" ident="TRUE"/>
    <column name="ordinal_position" type="gint" pkey="TRUE" descr="Ordinal position of the column within the constraint key (count starts at 1)"/>
    <fkey ref_table="_table_constraints">
      <part column="table_catalog"/>
      <part column="table_schema"/>
      <part column="table_name"/>
      <part column="constraint_name"/>
    </fkey>
    <fkey ref_table="_columns">
      <part column="table_catalog"/>
      <part column="table_schema"/>
      <part column="table_name"/>
      <part column="column_name"/>
    </fkey>
  </table>

  <!-- 
     This table lists foreign keys declared but no present in the database. The constraint name is mandatory.
    -->
  <table name="__declared_fk" descr="List of foreign key constraints, declared in Libgda and unknown to the database">
    <column name="constraint_name" pkey="TRUE"/>

    <column name="table_catalog" pkey="TRUE" ident="TRUE"/>
    <column name="table_schema" pkey="TRUE" ident="TRUE"/>
    <column name="table_name" pkey="TRUE" ident="TRUE"/>
    <column name="column_name" pkey="TRUE" ident="TRUE"/>

    <column name="ref_table_catalog" pkey="TRUE" ident="TRUE"/>
    <column name="ref_table_schema" pkey="TRUE" ident="TRUE"/>
    <column name="ref_table_name" pkey="TRUE" ident="TRUE"/>
    <column name="ref_column_name" pkey="TRUE" ident="TRUE"/>

    <column name="ts" type="timestamp" nullok="TRUE"/>
    <column name="descr" nullok="TRUE"/>

    <!-- FK indication, not enforced
    <fkey ref_table="_columns">
      <part column="table_catalog" ref_column="table_catalog"/>
      <part column="table_schema" ref_column="table_schema"/>
      <part column="table_name" ref_column="table_name"/>
      <part column="column_name" ref_column="column_name"/>
    </fkey>
    <fkey ref_table="_columns">
      <part column="ref_table_catalog" ref_column="table_catalog"/>
      <part column="ref_table_schema" ref_column="table_schema"/>
      <part column="ref_table_name" ref_column="table_name"/>
      <part column="ref_column_name" ref_column="column_name"/>
    </fkey>
    -->
  </table>

  <table name="_check_column_usage" descr="List of check constraints and the name of the tables' columns involved">
    <column name="table_catalog" pkey="TRUE" ident="TRUE"/>
    <column name="table_schema" pkey="TRUE" ident="TRUE"/>
    <column name="table_name" pkey="TRUE" ident="TRUE"/>
    <column name="constraint_name" pkey="TRUE" ident="TRUE"/>
    <column name="column_name" pkey="TRUE" ident="TRUE"/>
    <fkey ref_table="_table_constraints">
      <part column="table_catalog"/>
      <part column="table_schema"/>
      <part column="table_name"/>
      <part column="constraint_name"/>
    </fkey>
    <fkey ref_table="_columns">
      <part column="table_catalog"/>
      <part column="table_schema"/>
      <part column="table_name"/>
      <part column="column_name"/>
    </fkey>
  </table>

  <table name="_view_column_usage" descr="List of the tables' columns involved in a view">
    <column name="view_catalog" pkey="TRUE" ident="TRUE"/>
    <column name="view_schema" pkey="TRUE" ident="TRUE"/>
    <column name="view_name" pkey="TRUE" ident="TRUE"/>
    <column name="table_catalog" pkey="TRUE" ident="TRUE"/>
    <column name="table_schema" pkey="TRUE" ident="TRUE"/>
    <column name="table_name" pkey="TRUE" ident="TRUE"/>
    <column name="column_name" pkey="TRUE" ident="TRUE"/>
    <fkey ref_table="_views">
      <part column="view_catalog" ref_column="table_catalog"/>
      <part column="view_schema" ref_column="table_schema"/>
      <part column="view_name" ref_column="table_name"/>
    </fkey>
    <fkey ref_table="_columns">
      <part column="table_catalog"/>
      <part column="table_schema"/>
      <part column="table_name"/>
      <part column="column_name"/>
    </fkey>
  </table>

  <table name="_domain_constraints" descr="List of constraints applicable to domains">
    <column name="constraint_catalog" nullok="TRUE" descr="Name of the catalog that contains the constraint" ident="TRUE"/>
    <column name="constraint_schema" nullok="TRUE" descr="Name of the schema that contains the constraint" ident="TRUE"/>

    <column name="constraint_name" pkey="TRUE" ident="TRUE"/>
    <column name="domain_catalog" pkey="TRUE" ident="TRUE"/>
    <column name="domain_schema" pkey="TRUE" ident="TRUE"/>
    <column name="domain_name" pkey="TRUE" ident="TRUE"/>

    <column name="check_clause" nullok="TRUE"/>
    <column name="is_deferrable" type="boolean" nullok="TRUE"/>
    <column name="initially_deferred" type="boolean" nullok="TRUE"/>
    <fkey ref_table="_domains">
      <part column="domain_catalog"/>
      <part column="domain_schema"/>
      <part column="domain_name"/>
    </fkey>
    <fkey ref_table="_schemata">
      <part column="constraint_catalog" ref_column="catalog_name"/>
      <part column="constraint_schema"  ref_column="schema_name"/>
    </fkey>
  </table>

  <table name="_parameters" descr="List of routines' (functions and stored procedures) parameters (may not contain data for some routines which accept any type of parameter)">
    <column name="specific_catalog" pkey="TRUE" ident="TRUE"/>
    <column name="specific_schema" pkey="TRUE" ident="TRUE"/>
    <column name="specific_name" pkey="TRUE"/>
    <column name="ordinal_position" type="gint" pkey="TRUE"/>
    <column name="parameter_mode"/>
    <column name="parameter_name" nullok="TRUE" ident="TRUE"/>
    <column name="data_type" nullok="TRUE" descr="Data type of the parameter (if the parameter is an array, then 'array_spec' is set, and this may be NULL; can also be NULL if any type of parameter is accepted)"/>
    <column name="array_spec" nullok="TRUE" descr="Array description if the parameter is an array"/>
    <fkey ref_table="_routines">
      <part column="specific_catalog"/>
      <part column="specific_schema"/>
      <part column="specific_name"/>
    </fkey>
    <fkey ref_table="_element_types">
      <part column="array_spec" ref_column="specific_name"/>
    </fkey>
    <!--
    <fkey ref_table="_all_types">
      <part column="data_type" ref_column="full_type_name"/>
    </fkey>
    -->
  </table>

  <table name="_routine_columns" descr="List of routines' (functions and stored procedures) returned values' parts (columns) for routines returning composed values">
    <column name="specific_catalog" pkey="TRUE" ident="TRUE"/>
    <column name="specific_schema" pkey="TRUE" ident="TRUE"/>
    <column name="specific_name" pkey="TRUE"/>
    <column name="column_name" pkey="TRUE" ident="TRUE"/>
    <column name="ordinal_position" type="gint" nullok="TRUE" pkey="TRUE"/>
    <column name="data_type" nullok="TRUE" descr="Data type of the column (if the column is an array, then 'array_spec' is set, and this may be NULL)"/>
    <column name="array_spec" nullok="TRUE" descr="Array description if the column is an array"/>
    <fkey ref_table="_routines">
      <part column="specific_catalog"/>
      <part column="specific_schema"/>
      <part column="specific_name"/>
    </fkey>
    <fkey ref_table="_element_types">
      <part column="array_spec" ref_column="specific_name"/>
    </fkey>
    <!--
    <fkey ref_table="_all_types">
      <part column="data_type" ref_column="full_type_name"/>
    </fkey>
    -->
  </table>

  <table name="_table_indexes" descr="List of tables' indexes which do not relate to primary keys">
    <column name="index_catalog" nullok="TRUE" descr="Name of the catalog that contains the index" ident="TRUE"/>
    <column name="index_schema" nullok="TRUE" descr="Name of the schema that contains the index" ident="TRUE"/>
    <column name="index_name" pkey="TRUE" ident="TRUE"/>
    <column name="table_catalog" pkey="TRUE" ident="TRUE"/>
    <column name="table_schema" pkey="TRUE" ident="TRUE"/>
    <column name="table_name" pkey="TRUE" ident="TRUE"/>
    <column name="is_unique" type="boolean" descr="" nullok="TRUE"/>
    <column name="index_def" descr="Index definition" nullok="TRUE"/>
    <column name="index_type" nullok="TRUE" descr="Database specific type of index such as BTREE, ..."/>
    <column name="extra" nullok="TRUE" descr="CSV string with: ASCENDING, ..."/>
    <column name="index_owner" nullok="TRUE"/>
    <column name="index_comments" nullok="TRUE"/>
    <fkey ref_table="_tables">
      <part column="table_catalog"/>
      <part column="table_schema"/>
      <part column="table_name"/>
    </fkey>
  </table>

  <table name="_index_column_usage" descr="List of the tables' columns involved in an index listed in the _table_indexes table">
    <column name="index_catalog" nullok="TRUE" ident="TRUE"/>
    <column name="index_schema" nullok="TRUE" ident="TRUE"/>
    <column name="index_name" pkey="TRUE" ident="TRUE"/>
    <column name="table_catalog" pkey="TRUE" ident="TRUE"/>
    <column name="table_schema" pkey="TRUE" ident="TRUE"/>
    <column name="table_name" pkey="TRUE" ident="TRUE"/>
    <column name="column_name" pkey="TRUE" nullok="TRUE" ident="TRUE"/>
    <column name="column_expr" pkey="TRUE" nullok="TRUE"/>
    <column name="ordinal_position" type="gint" descr="Column position in the index, starts at 1"/>
    <fkey ref_table="_table_indexes">
      <part column="index_name"/>
      <part column="table_catalog"/>
      <part column="table_schema"/>
      <part column="table_name"/>
    </fkey>
    <!--
    <fkey ref_table="_columns">
      <part column="table_catalog"/>
      <part column="table_schema"/>
      <part column="table_name"/>
      <part column="column_name"/>
    </fkey>
    -->
  </table>
  
  <view name="_all_types" descr="List of all the data types">
    <definition>SELECT short_type_name AS short_type_name, gtype, full_type_name AS full_type_name, comments, internal AS internal, synonyms,
       NULL AS domain_catalog, NULL AS domain_schema, NULL AS domain_name,
       NULL AS udt_catalog, NULL AS udt_schema, NULL AS udt_name
       FROM _builtin_data_types
UNION
SELECT udt_short_name, udt_gtype, udt_full_name, udt_comments, udt_internal, NULL,
       NULL, NULL, NULL, udt_catalog, udt_schema, udt_name FROM _udt
UNION
SELECT domain_short_name, domain_gtype, domain_full_name, domain_comments, domain_internal, NULL,
       domain_catalog, domain_schema, domain_name , NULL, NULL, NULL FROM _domains</definition>
  </view>

  <view name="_detailed_fk" descr="For each foreign key constraint, lists all the tables' columns involved and the constraint name">
    <definition>SELECT rc.table_catalog as fk_table_catalog, rc.table_schema as fk_table_schema, rc.table_name as fk_table_name, kc1.column_name as fk_column,
      rc.ref_table_catalog as ref_table_catalog, rc.ref_table_schema as ref_table_schema, rc.ref_table_name as ref_table_name, kc2.column_name as ref_column,
      rc.constraint_name as fk_constraint_name, kc1.ordinal_position as ordinal_position
      FROM _referential_constraints rc 
      INNER JOIN _key_column_usage kc2 ON (rc.ref_table_catalog=kc2.table_catalog AND rc.ref_table_schema=kc2.table_schema AND rc.ref_table_name=kc2.table_name AND rc.ref_constraint_name=kc2.constraint_name) 
      INNER JOIN _key_column_usage kc1 ON (rc.table_catalog=kc1.table_catalog AND rc.table_schema=kc1.table_schema AND rc.table_name=kc1.table_name AND rc.constraint_name=kc1.constraint_name) 
      WHERE kc1.ordinal_position = kc2.ordinal_position 
      ORDER BY rc.table_catalog, rc.table_schema, rc.table_name, kc1.ordinal_position
    </definition>
  </view>

</schema>