| 1 |
<!-- |
|---|
| 2 |
$Header: /var/lib/cvs/pgsql-fr/sgml/ref/comment.sgml,v 1.7 2004/12/21 23:09:12 guillaume Exp $ |
|---|
| 3 |
PostgreSQL documentation |
|---|
| 4 |
--> |
|---|
| 5 |
|
|---|
| 6 |
<refentry id="SQL-COMMENT"> |
|---|
| 7 |
<refmeta> |
|---|
| 8 |
<refentrytitle id="SQL-COMMENT-TITLE">COMMENT</refentrytitle> |
|---|
| 9 |
<refmiscinfo>SQL - Instructions du langage</refmiscinfo> |
|---|
| 10 |
</refmeta> |
|---|
| 11 |
|
|---|
| 12 |
<refnamediv> |
|---|
| 13 |
<refname>COMMENT</refname> |
|---|
| 14 |
<refpurpose>définit ou modifie le commentaire sur un objet</refpurpose> |
|---|
| 15 |
</refnamediv> |
|---|
| 16 |
|
|---|
| 17 |
<indexterm zone="sql-comment"> |
|---|
| 18 |
<primary>COMMENT</primary> |
|---|
| 19 |
</indexterm> |
|---|
| 20 |
|
|---|
| 21 |
<refsynopsisdiv> |
|---|
| 22 |
<synopsis> |
|---|
| 23 |
COMMENT ON |
|---|
| 24 |
{ |
|---|
| 25 |
TABLE <replaceable class="PARAMETER">nom_objet</replaceable> | |
|---|
| 26 |
COLUMN <replaceable class="PARAMETER">nom_table</replaceable>.<replaceable |
|---|
| 27 |
class="PARAMETER">nom_colonne</replaceable> | |
|---|
| 28 |
AGGREGATE <replaceable class="PARAMETER">nom_agrégat</replaceable> |
|---|
| 29 |
(<replaceable class="PARAMETER">type_agrégat</replaceable>) | |
|---|
| 30 |
CONSTRAINT <replaceable class="PARAMETER">nom_contrainte</replaceable> ON |
|---|
| 31 |
<replaceable class="PARAMETER">nom_table</replaceable> | |
|---|
| 32 |
DATABASE <replaceable class="PARAMETER">nom_objet</replaceable> | |
|---|
| 33 |
DOMAIN <replaceable class="PARAMETER">nom_objet</replaceable> | |
|---|
| 34 |
FUNCTION <replaceable class="PARAMETER">nom_fonction</replaceable> |
|---|
| 35 |
(<replaceable class="PARAMETER">type_arg1</replaceable>, <replaceable |
|---|
| 36 |
class="PARAMETER">type_arg2</replaceable>, ...) | |
|---|
| 37 |
INDEX <replaceable class="PARAMETER">nom_objet</replaceable> | |
|---|
| 38 |
OPERATOR <replaceable class="PARAMETER">op</replaceable> (<replaceable |
|---|
| 39 |
class="PARAMETER">type_operande1</replaceable>, <replaceable |
|---|
| 40 |
class="PARAMETER">type_operande2</replaceable>) | |
|---|
| 41 |
RULE <replaceable class="PARAMETER">nom_role</replaceable> ON <replaceable |
|---|
| 42 |
class="PARAMETER">nom_table</replaceable> | |
|---|
| 43 |
SCHEMA <replaceable class="PARAMETER">nom_objet</replaceable> | |
|---|
| 44 |
SEQUENCE <replaceable class="PARAMETER">nom_objet</replaceable> | |
|---|
| 45 |
TRIGGER <replaceable class="PARAMETER">nom_declencheur</replaceable> ON |
|---|
| 46 |
<replaceable class="PARAMETER">nom_table</replaceable> | |
|---|
| 47 |
TYPE <replaceable class="PARAMETER">nom_objet</replaceable> | |
|---|
| 48 |
VIEW <replaceable class="PARAMETER">nom_objet</replaceable> |
|---|
| 49 |
} IS <replaceable class="PARAMETER">'texte'</replaceable> |
|---|
| 50 |
</synopsis> |
|---|
| 51 |
</refsynopsisdiv> |
|---|
| 52 |
|
|---|
| 53 |
<refsect1> |
|---|
| 54 |
<title>Description</title> |
|---|
| 55 |
|
|---|
| 56 |
<para> |
|---|
| 57 |
<command>COMMENT</command> stocke un commentaire sur un objet de base de |
|---|
| 58 |
données. Les commentaires peuvent être facilement récupérés avec les |
|---|
| 59 |
commandes de <application>psql</application> <command>\dd</command>, |
|---|
| 60 |
<command>\d+</command> et <command>\l+</command>. Les autres interfaces |
|---|
| 61 |
utilisateur permettant de récupérer les commentaires peuvent être |
|---|
| 62 |
construites au-dessus des même fonctions intégrées que celles utilisées par |
|---|
| 63 |
<application>psql</application>, nommément <function>obj_description</> et |
|---|
| 64 |
<function>col_description</>. |
|---|
| 65 |
</para> |
|---|
| 66 |
|
|---|
| 67 |
<para> |
|---|
| 68 |
Pour modifier un commentaire, lancez une nouvelle commande |
|---|
| 69 |
<command>COMMENT</> pour le même objet. Seule une chaîne de commentaire est |
|---|
| 70 |
stockée pour chaque objet. Pour supprimer un commentaire, écrivez |
|---|
| 71 |
<literal>NULL</literal> à la place de la chaîne de texte. Les commentaires |
|---|
| 72 |
sont automatiquement supprimés lorsque l'objet est supprimé. |
|---|
| 73 |
</para> |
|---|
| 74 |
</refsect1> |
|---|
| 75 |
|
|---|
| 76 |
<refsect1> |
|---|
| 77 |
<title>Paramètres</title> |
|---|
| 78 |
|
|---|
| 79 |
<variablelist> |
|---|
| 80 |
<varlistentry> |
|---|
| 81 |
<term><replaceable class="parameter">nom_objet</replaceable></term> |
|---|
| 82 |
<term><replaceable |
|---|
| 83 |
class="parameter">nom_table.nom_colonne</replaceable></term> |
|---|
| 84 |
<term><replaceable class="parameter">nom_agregat</replaceable></term> |
|---|
| 85 |
<term><replaceable class="parameter">nom_contrainte</replaceable></term> |
|---|
| 86 |
<term><replaceable class="parameter">nom_fonction</replaceable></term> |
|---|
| 87 |
<term><replaceable class="parameter">op</replaceable></term> |
|---|
| 88 |
<term><replaceable class="parameter">nom_regle</replaceable></term> |
|---|
| 89 |
<term><replaceable class="parameter">nom_declencheur</replaceable></term> |
|---|
| 90 |
<listitem> |
|---|
| 91 |
<para> |
|---|
| 92 |
Le nom de l'objet à commenter. Les noms des tables, |
|---|
| 93 |
agrégats, domaines, fonctions, index, opérateurs, séquences, |
|---|
| 94 |
types et vues pourraient être qualifiés du nom du schéma. |
|---|
| 95 |
</para> |
|---|
| 96 |
</listitem> |
|---|
| 97 |
</varlistentry> |
|---|
| 98 |
|
|---|
| 99 |
<varlistentry> |
|---|
| 100 |
<term><replaceable class="parameter">texte</replaceable></term> |
|---|
| 101 |
<listitem> |
|---|
| 102 |
<para> |
|---|
| 103 |
Le nouveau commentaire. |
|---|
| 104 |
</para> |
|---|
| 105 |
</listitem> |
|---|
| 106 |
</varlistentry> |
|---|
| 107 |
</variablelist> |
|---|
| 108 |
</refsect1> |
|---|
| 109 |
|
|---|
| 110 |
<refsect1> |
|---|
| 111 |
<title>Notes</title> |
|---|
| 112 |
|
|---|
| 113 |
<para> |
|---|
| 114 |
Il n'existe pas de mécanisme de sécurité pour les commentaires : |
|---|
| 115 |
tout utilisateur connecté à une base de données peut voir tous les |
|---|
| 116 |
commentaires des objets dans la base de données (bien que seuls les |
|---|
| 117 |
superutilisateurs peuvent modifier les commentaires sur des objets qu'ils |
|---|
| 118 |
ne possèdent pas). Du coup, ne placez pas d'informations critiques en terme |
|---|
| 119 |
de sécurité dans vos commentaires. |
|---|
| 120 |
</para> |
|---|
| 121 |
</refsect1> |
|---|
| 122 |
|
|---|
| 123 |
<refsect1> |
|---|
| 124 |
<title>Exemples</title> |
|---|
| 125 |
|
|---|
| 126 |
<para> |
|---|
| 127 |
Attacher un commentaire sur la table <literal>matable</literal> : |
|---|
| 128 |
|
|---|
| 129 |
<programlisting> |
|---|
| 130 |
COMMENT ON TABLE matable IS 'Ceci est ma table.'; |
|---|
| 131 |
</programlisting> |
|---|
| 132 |
|
|---|
| 133 |
Supprimez-le de nouveau : |
|---|
| 134 |
|
|---|
| 135 |
<programlisting> |
|---|
| 136 |
COMMENT ON TABLE matable IS NULL; |
|---|
| 137 |
</programlisting> |
|---|
| 138 |
</para> |
|---|
| 139 |
|
|---|
| 140 |
<para> |
|---|
| 141 |
Quelques exemples supplémentaires : |
|---|
| 142 |
|
|---|
| 143 |
<programlisting> |
|---|
| 144 |
COMMENT ON AGGREGATE mon_agregat (double precision) IS 'Calcule une variance |
|---|
| 145 |
type'; |
|---|
| 146 |
COMMENT ON COLUMN ma_table.ma_colonne IS 'Numéro employé'; |
|---|
| 147 |
COMMENT ON DATABASE ma_database IS 'Base de données de développement'; |
|---|
| 148 |
COMMENT ON DOMAIN mon_domaine IS 'Domaine des adresses email'; |
|---|
| 149 |
COMMENT ON FUNCTION ma_fonction (timestamp) IS 'Renvoie en chiffres romain'; |
|---|
| 150 |
COMMENT ON INDEX mon_index IS 'Renforce l'unicité de l'ID de l'employé'; |
|---|
| 151 |
COMMENT ON OPERATOR ^ (text, text) IS 'Traite l\'intersection de deux textes'; |
|---|
| 152 |
COMMENT ON OPERATOR ^ (NONE, text) IS 'Opérateur de préfix sur un texte'; |
|---|
| 153 |
COMMENT ON RULE ma_regle ON my_table IS 'Trace les mises à jour des |
|---|
| 154 |
enregistrements d\'employé'; |
|---|
| 155 |
COMMENT ON SCHEMA mon_schema IS 'Données du département'; |
|---|
| 156 |
COMMENT ON SEQUENCE ma_sequence IS 'Utilisé pour générer des clés primaires'; |
|---|
| 157 |
COMMENT ON TABLE mon_schema.ma_table IS 'Informations sur les employés'; |
|---|
| 158 |
COMMENT ON TRIGGER mon_declencheur ON my_table IS 'Utilisé pour RI'; |
|---|
| 159 |
COMMENT ON TYPE complex IS 'Type de données pour les nombres complexes'; |
|---|
| 160 |
COMMENT ON VIEW ma_vue IS 'Vue des coûts départementaux'; |
|---|
| 161 |
</programlisting> |
|---|
| 162 |
</para> |
|---|
| 163 |
</refsect1> |
|---|
| 164 |
|
|---|
| 165 |
<refsect1> |
|---|
| 166 |
<title>Compatibilité</title> |
|---|
| 167 |
|
|---|
| 168 |
<para> |
|---|
| 169 |
Il n'existe pas de commande <command>COMMENT</command> dans le standard SQL. |
|---|
| 170 |
</para> |
|---|
| 171 |
</refsect1> |
|---|
| 172 |
</refentry> |
|---|
| 173 |
|
|---|
| 174 |
<!-- Keep this comment at the end of the file |
|---|
| 175 |
Local variables: |
|---|
| 176 |
mode: sgml |
|---|
| 177 |
sgml-omittag:t |
|---|
| 178 |
sgml-shorttag:t |
|---|
| 179 |
sgml-minimize-attributes:nil |
|---|
| 180 |
sgml-always-quote-attributes:t |
|---|
| 181 |
sgml-indent-step:1 |
|---|
| 182 |
sgml-indent-data:t |
|---|
| 183 |
sgml-parent-document:nil |
|---|
| 184 |
sgml-default-dtd-file:"../reference.ced" |
|---|
| 185 |
sgml-exposed-tags:nil |
|---|
| 186 |
sgml-local-catalogs:"/usr/lib/sgml/catalog" |
|---|
| 187 |
sgml-local-ecat-files:nil |
|---|
| 188 |
End: |
|---|
| 189 |
--> |
|---|