]> granicus.if.org Git - postgresql/commitdiff
Avoid maintaining three separate copies of the error codes list.
authorRobert Haas <rhaas@postgresql.org>
Fri, 4 Feb 2011 03:32:49 +0000 (22:32 -0500)
committerRobert Haas <rhaas@postgresql.org>
Fri, 4 Feb 2011 03:32:49 +0000 (22:32 -0500)
src/pl/plpgsql/src/plerrcodes.h, src/include/utils/errcodes.h, and a
big chunk of errcodes.sgml are now automatically generated from a single
file, src/backend/utils/errcodes.txt.

Jan UrbaƄski, reviewed by Tom Lane.

20 files changed:
doc/src/sgml/.gitignore
doc/src/sgml/Makefile
doc/src/sgml/errcodes.sgml
doc/src/sgml/filelist.sgml
doc/src/sgml/generate-errcodes-table.pl [new file with mode: 0644]
src/Makefile
src/backend/Makefile
src/backend/utils/.gitignore
src/backend/utils/Makefile
src/backend/utils/errcodes.txt [new file with mode: 0644]
src/backend/utils/generate-errcodes.pl [new file with mode: 0644]
src/include/Makefile
src/include/utils/.gitignore
src/include/utils/errcodes.h [deleted file]
src/pl/plpgsql/src/.gitignore
src/pl/plpgsql/src/Makefile
src/pl/plpgsql/src/generate-plerrcodes.pl [new file with mode: 0644]
src/pl/plpgsql/src/plerrcodes.h [deleted file]
src/tools/msvc/Solution.pm
src/tools/msvc/builddoc.bat

index 62a38d2183d6092c74762b6fd35e6ca87e997007..e1b84b490fedf7ddaf1faba574c3ee67c768b326 100644 (file)
@@ -16,6 +16,7 @@
 # GENERATED_SGML
 /features-supported.sgml
 /features-unsupported.sgml
+/errcodes-table.sgml
 /version.sgml
 /bookindex.sgml
 /HTML.index
index a797499c792fc3c0812ece3c5dcd180529f3f7ec..add2c282c6bfb897488c1fd3e55ffbc31236ae8b 100644 (file)
@@ -52,7 +52,7 @@ override XSLTPROCFLAGS += --stringparam pg.version '$(VERSION)'
 
 
 GENERATED_SGML = bookindex.sgml version.sgml \
-       features-supported.sgml features-unsupported.sgml
+       features-supported.sgml features-unsupported.sgml errcodes-table.sgml
 
 ALLSGML := $(wildcard $(srcdir)/*.sgml $(srcdir)/ref/*.sgml) $(GENERATED_SGML)
 
@@ -136,6 +136,8 @@ features-supported.sgml: $(top_srcdir)/src/backend/catalog/sql_feature_packages.
 features-unsupported.sgml: $(top_srcdir)/src/backend/catalog/sql_feature_packages.txt $(top_srcdir)/src/backend/catalog/sql_features.txt
        $(PERL) $(srcdir)/mk_feature_tables.pl NO $^ > $@
 
+errcodes-table.sgml: $(top_srcdir)/src/backend/utils/errcodes.txt generate-errcodes-table.pl
+       $(PERL) $(srcdir)/generate-errcodes-table.pl $< > $@
 
 ##
 ## Print
index c05b4caf2688791abcb33547eb57e3e93ebc1605..024ec71727e6438c41e64e9d40f2d0cfd0dde01a 100644 (file)
 
   <tbody>
 
-<row>
-<entry spanname="span13"><emphasis role="bold">Class 00 &mdash; Successful Completion</></entry>
-</row>
-
-<row>
-<entry><literal>00000</literal></entry>
-<entry>SUCCESSFUL COMPLETION</entry>
-<entry>successful_completion</entry>
-</row>
-
-
-<row>
-<entry spanname="span13"><emphasis role="bold">Class 01 &mdash; Warning</></entry>
-</row>
-
-<row>
-<entry><literal>01000</literal></entry>
-<entry>WARNING</entry>
-<entry>warning</entry>
-</row>
-
-<row>
-<entry><literal>0100C</literal></entry>
-<entry>DYNAMIC RESULT SETS RETURNED</entry>
-<entry>dynamic_result_sets_returned</entry>
-</row>
-
-<row>
-<entry><literal>01008</literal></entry>
-<entry>IMPLICIT ZERO BIT PADDING</entry>
-<entry>implicit_zero_bit_padding</entry>
-</row>
-
-<row>
-<entry><literal>01003</literal></entry>
-<entry>NULL VALUE ELIMINATED IN SET FUNCTION</entry>
-<entry>null_value_eliminated_in_set_function</entry>
-</row>
-
-<row>
-<entry><literal>01007</literal></entry>
-<entry>PRIVILEGE NOT GRANTED</entry>
-<entry>privilege_not_granted</entry>
-</row>
-
-<row>
-<entry><literal>01006</literal></entry>
-<entry>PRIVILEGE NOT REVOKED</entry>
-<entry>privilege_not_revoked</entry>
-</row>
-
-<row>
-<entry><literal>01004</literal></entry>
-<entry>STRING DATA RIGHT TRUNCATION</entry>
-<entry>string_data_right_truncation</entry>
-</row>
-
-<row>
-<entry><literal>01P01</literal></entry>
-<entry>DEPRECATED FEATURE</entry>
-<entry>deprecated_feature</entry>
-</row>
-
-
-<row>
-<entry spanname="span13"><emphasis role="bold">Class 02 &mdash; No Data (this is also a warning class per the SQL standard)</></entry>
-</row>
-
-<row>
-<entry><literal>02000</literal></entry>
-<entry>NO DATA</entry>
-<entry>no_data</entry>
-</row>
-
-<row>
-<entry><literal>02001</literal></entry>
-<entry>NO ADDITIONAL DYNAMIC RESULT SETS RETURNED</entry>
-<entry>no_additional_dynamic_result_sets_returned</entry>
-</row>
-
-
-<row>
-<entry spanname="span13"><emphasis role="bold">Class 03 &mdash; SQL Statement Not Yet Complete</></entry>
-</row>
-
-<row>
-<entry><literal>03000</literal></entry>
-<entry>SQL STATEMENT NOT YET COMPLETE</entry>
-<entry>sql_statement_not_yet_complete</entry>
-</row>
-
-
-<row>
-<entry spanname="span13"><emphasis role="bold">Class 08 &mdash; Connection Exception</></entry>
-</row>
-
-<row>
-<entry><literal>08000</literal></entry>
-<entry>CONNECTION EXCEPTION</entry>
-<entry>connection_exception</entry>
-</row>
-
-<row>
-<entry><literal>08003</literal></entry>
-<entry>CONNECTION DOES NOT EXIST</entry>
-<entry>connection_does_not_exist</entry>
-</row>
-
-<row>
-<entry><literal>08006</literal></entry>
-<entry>CONNECTION FAILURE</entry>
-<entry>connection_failure</entry>
-</row>
-
-<row>
-<entry><literal>08001</literal></entry>
-<entry>SQLCLIENT UNABLE TO ESTABLISH SQLCONNECTION</entry>
-<entry>sqlclient_unable_to_establish_sqlconnection</entry>
-</row>
-
-<row>
-<entry><literal>08004</literal></entry>
-<entry>SQLSERVER REJECTED ESTABLISHMENT OF SQLCONNECTION</entry>
-<entry>sqlserver_rejected_establishment_of_sqlconnection</entry>
-</row>
-
-<row>
-<entry><literal>08007</literal></entry>
-<entry>TRANSACTION RESOLUTION UNKNOWN</entry>
-<entry>transaction_resolution_unknown</entry>
-</row>
-
-<row>
-<entry><literal>08P01</literal></entry>
-<entry>PROTOCOL VIOLATION</entry>
-<entry>protocol_violation</entry>
-</row>
-
-
-<row>
-<entry spanname="span13"><emphasis role="bold">Class 09 &mdash; Triggered Action Exception</></entry>
-</row>
-
-<row>
-<entry><literal>09000</literal></entry>
-<entry>TRIGGERED ACTION EXCEPTION</entry>
-<entry>triggered_action_exception</entry>
-</row>
-
-
-<row>
-<entry spanname="span13"><emphasis role="bold">Class 0A &mdash; Feature Not Supported</></entry>
-</row>
-
-<row>
-<entry><literal>0A000</literal></entry>
-<entry>FEATURE NOT SUPPORTED</entry>
-<entry>feature_not_supported</entry>
-</row>
-
-
-<row>
-<entry spanname="span13"><emphasis role="bold">Class 0B &mdash; Invalid Transaction Initiation</></entry>
-</row>
-
-<row>
-<entry><literal>0B000</literal></entry>
-<entry>INVALID TRANSACTION INITIATION</entry>
-<entry>invalid_transaction_initiation</entry>
-</row>
-
-
-<row>
-<entry spanname="span13"><emphasis role="bold">Class 0F &mdash; Locator Exception</></entry>
-</row>
-
-<row>
-<entry><literal>0F000</literal></entry>
-<entry>LOCATOR EXCEPTION</entry>
-<entry>locator_exception</entry>
-</row>
-
-<row>
-<entry><literal>0F001</literal></entry>
-<entry>INVALID LOCATOR SPECIFICATION</entry>
-<entry>invalid_locator_specification</entry>
-</row>
-
-
-<row>
-<entry spanname="span13"><emphasis role="bold">Class 0L &mdash; Invalid Grantor</></entry>
-</row>
-
-<row>
-<entry><literal>0L000</literal></entry>
-<entry>INVALID GRANTOR</entry>
-<entry>invalid_grantor</entry>
-</row>
-
-<row>
-<entry><literal>0LP01</literal></entry>
-<entry>INVALID GRANT OPERATION</entry>
-<entry>invalid_grant_operation</entry>
-</row>
-
-
-<row>
-<entry spanname="span13"><emphasis role="bold">Class 0P &mdash; Invalid Role Specification</></entry>
-</row>
-
-<row>
-<entry><literal>0P000</literal></entry>
-<entry>INVALID ROLE SPECIFICATION</entry>
-<entry>invalid_role_specification</entry>
-</row>
-
-
-<row>
-<entry spanname="span13"><emphasis role="bold">Class 20 &mdash; Case Not Found</></entry>
-</row>
-
-<row>
-<entry><literal>20000</literal></entry>
-<entry>CASE NOT FOUND</entry>
-<entry>case_not_found</entry>
-</row>
-
-
-<row>
-<entry spanname="span13"><emphasis role="bold">Class 21 &mdash; Cardinality Violation</></entry>
-</row>
-
-<row>
-<entry><literal>21000</literal></entry>
-<entry>CARDINALITY VIOLATION</entry>
-<entry>cardinality_violation</entry>
-</row>
-
-
-<row>
-<entry spanname="span13"><emphasis role="bold">Class 22 &mdash; Data Exception</></entry>
-</row>
-
-<row>
-<entry><literal>22000</literal></entry>
-<entry>DATA EXCEPTION</entry>
-<entry>data_exception</entry>
-</row>
-
-<row>
-<entry><literal>2202E</literal></entry>
-<entry>ARRAY SUBSCRIPT ERROR</entry>
-<entry>array_subscript_error</entry>
-</row>
-
-<row>
-<entry><literal>22021</literal></entry>
-<entry>CHARACTER NOT IN REPERTOIRE</entry>
-<entry>character_not_in_repertoire</entry>
-</row>
-
-<row>
-<entry><literal>22008</literal></entry>
-<entry>DATETIME FIELD OVERFLOW</entry>
-<entry>datetime_field_overflow</entry>
-</row>
-
-<row>
-<entry><literal>22012</literal></entry>
-<entry>DIVISION BY ZERO</entry>
-<entry>division_by_zero</entry>
-</row>
-
-<row>
-<entry><literal>22005</literal></entry>
-<entry>ERROR IN ASSIGNMENT</entry>
-<entry>error_in_assignment</entry>
-</row>
-
-<row>
-<entry><literal>2200B</literal></entry>
-<entry>ESCAPE CHARACTER CONFLICT</entry>
-<entry>escape_character_conflict</entry>
-</row>
-
-<row>
-<entry><literal>22022</literal></entry>
-<entry>INDICATOR OVERFLOW</entry>
-<entry>indicator_overflow</entry>
-</row>
-
-<row>
-<entry><literal>22015</literal></entry>
-<entry>INTERVAL FIELD OVERFLOW</entry>
-<entry>interval_field_overflow</entry>
-</row>
-
-<row>
-<entry><literal>2201E</literal></entry>
-<entry>INVALID ARGUMENT FOR LOGARITHM</entry>
-<entry>invalid_argument_for_logarithm</entry>
-</row>
-
-<row>
-<entry><literal>22014</literal></entry>
-<entry>INVALID ARGUMENT FOR NTILE FUNCTION</entry>
-<entry>invalid_argument_for_ntile_function</entry>
-</row>
-
-<row>
-<entry><literal>22016</literal></entry>
-<entry>INVALID ARGUMENT FOR NTH_VALUE FUNCTION</entry>
-<entry>invalid_argument_for_nth_value_function</entry>
-</row>
-
-<row>
-<entry><literal>2201F</literal></entry>
-<entry>INVALID ARGUMENT FOR POWER FUNCTION</entry>
-<entry>invalid_argument_for_power_function</entry>
-</row>
-
-<row>
-<entry><literal>2201G</literal></entry>
-<entry>INVALID ARGUMENT FOR WIDTH BUCKET FUNCTION</entry>
-<entry>invalid_argument_for_width_bucket_function</entry>
-</row>
-
-<row>
-<entry><literal>22018</literal></entry>
-<entry>INVALID CHARACTER VALUE FOR CAST</entry>
-<entry>invalid_character_value_for_cast</entry>
-</row>
-
-<row>
-<entry><literal>22007</literal></entry>
-<entry>INVALID DATETIME FORMAT</entry>
-<entry>invalid_datetime_format</entry>
-</row>
-
-<row>
-<entry><literal>22019</literal></entry>
-<entry>INVALID ESCAPE CHARACTER</entry>
-<entry>invalid_escape_character</entry>
-</row>
-
-<row>
-<entry><literal>2200D</literal></entry>
-<entry>INVALID ESCAPE OCTET</entry>
-<entry>invalid_escape_octet</entry>
-</row>
-
-<row>
-<entry><literal>22025</literal></entry>
-<entry>INVALID ESCAPE SEQUENCE</entry>
-<entry>invalid_escape_sequence</entry>
-</row>
-
-<row>
-<entry><literal>22P06</literal></entry>
-<entry>NONSTANDARD USE OF ESCAPE CHARACTER</entry>
-<entry>nonstandard_use_of_escape_character</entry>
-</row>
-
-<row>
-<entry><literal>22010</literal></entry>
-<entry>INVALID INDICATOR PARAMETER VALUE</entry>
-<entry>invalid_indicator_parameter_value</entry>
-</row>
-
-<row>
-<entry><literal>22023</literal></entry>
-<entry>INVALID PARAMETER VALUE</entry>
-<entry>invalid_parameter_value</entry>
-</row>
-
-<row>
-<entry><literal>2201B</literal></entry>
-<entry>INVALID REGULAR EXPRESSION</entry>
-<entry>invalid_regular_expression</entry>
-</row>
-
-<row>
-<entry><literal>2201W</literal></entry>
-<entry>INVALID ROW COUNT IN LIMIT CLAUSE</entry>
-<entry>invalid_row_count_in_limit_clause</entry>
-</row>
-
-<row>
-<entry><literal>2201X</literal></entry>
-<entry>INVALID ROW COUNT IN RESULT OFFSET CLAUSE</entry>
-<entry>invalid_row_count_in_result_offset_clause</entry>
-</row>
-
-<row>
-<entry><literal>22009</literal></entry>
-<entry>INVALID TIME ZONE DISPLACEMENT VALUE</entry>
-<entry>invalid_time_zone_displacement_value</entry>
-</row>
-
-<row>
-<entry><literal>2200C</literal></entry>
-<entry>INVALID USE OF ESCAPE CHARACTER</entry>
-<entry>invalid_use_of_escape_character</entry>
-</row>
-
-<row>
-<entry><literal>2200G</literal></entry>
-<entry>MOST SPECIFIC TYPE MISMATCH</entry>
-<entry>most_specific_type_mismatch</entry>
-</row>
-
-<row>
-<entry><literal>22004</literal></entry>
-<entry>NULL VALUE NOT ALLOWED</entry>
-<entry>null_value_not_allowed</entry>
-</row>
-
-<row>
-<entry><literal>22002</literal></entry>
-<entry>NULL VALUE NO INDICATOR PARAMETER</entry>
-<entry>null_value_no_indicator_parameter</entry>
-</row>
-
-<row>
-<entry><literal>22003</literal></entry>
-<entry>NUMERIC VALUE OUT OF RANGE</entry>
-<entry>numeric_value_out_of_range</entry>
-</row>
-
-<row>
-<entry><literal>22026</literal></entry>
-<entry>STRING DATA LENGTH MISMATCH</entry>
-<entry>string_data_length_mismatch</entry>
-</row>
-
-<row>
-<entry><literal>22001</literal></entry>
-<entry>STRING DATA RIGHT TRUNCATION</entry>
-<entry>string_data_right_truncation</entry>
-</row>
-
-<row>
-<entry><literal>22011</literal></entry>
-<entry>SUBSTRING ERROR</entry>
-<entry>substring_error</entry>
-</row>
-
-<row>
-<entry><literal>22027</literal></entry>
-<entry>TRIM ERROR</entry>
-<entry>trim_error</entry>
-</row>
-
-<row>
-<entry><literal>22024</literal></entry>
-<entry>UNTERMINATED C STRING</entry>
-<entry>unterminated_c_string</entry>
-</row>
-
-<row>
-<entry><literal>2200F</literal></entry>
-<entry>ZERO LENGTH CHARACTER STRING</entry>
-<entry>zero_length_character_string</entry>
-</row>
-
-<row>
-<entry><literal>22P01</literal></entry>
-<entry>FLOATING POINT EXCEPTION</entry>
-<entry>floating_point_exception</entry>
-</row>
-
-<row>
-<entry><literal>22P02</literal></entry>
-<entry>INVALID TEXT REPRESENTATION</entry>
-<entry>invalid_text_representation</entry>
-</row>
-
-<row>
-<entry><literal>22P03</literal></entry>
-<entry>INVALID BINARY REPRESENTATION</entry>
-<entry>invalid_binary_representation</entry>
-</row>
-
-<row>
-<entry><literal>22P04</literal></entry>
-<entry>BAD COPY FILE FORMAT</entry>
-<entry>bad_copy_file_format</entry>
-</row>
-
-<row>
-<entry><literal>22P05</literal></entry>
-<entry>UNTRANSLATABLE CHARACTER</entry>
-<entry>untranslatable_character</entry>
-</row>
-
-<row>
-<entry><literal>2200L</literal></entry>
-<entry>NOT AN XML DOCUMENT</entry>
-<entry>not_an_xml_document</entry>
-</row>
-
-<row>
-<entry><literal>2200M</literal></entry>
-<entry>INVALID XML DOCUMENT</entry>
-<entry>invalid_xml_document</entry>
-</row>
-
-<row>
-<entry><literal>2200N</literal></entry>
-<entry>INVALID XML CONTENT</entry>
-<entry>invalid_xml_content</entry>
-</row>
-
-<row>
-<entry><literal>2200S</literal></entry>
-<entry>INVALID XML COMMENT</entry>
-<entry>invalid_xml_comment</entry>
-</row>
-
-<row>
-<entry><literal>2200T</literal></entry>
-<entry>INVALID XML PROCESSING INSTRUCTION</entry>
-<entry>invalid_xml_processing_instruction</entry>
-</row>
-
-<row>
-<entry spanname="span13"><emphasis role="bold">Class 23 &mdash; Integrity Constraint Violation</></entry>
-</row>
-
-<row>
-<entry><literal>23000</literal></entry>
-<entry>INTEGRITY CONSTRAINT VIOLATION</entry>
-<entry>integrity_constraint_violation</entry>
-</row>
-
-<row>
-<entry><literal>23001</literal></entry>
-<entry>RESTRICT VIOLATION</entry>
-<entry>restrict_violation</entry>
-</row>
-
-<row>
-<entry><literal>23502</literal></entry>
-<entry>NOT NULL VIOLATION</entry>
-<entry>not_null_violation</entry>
-</row>
-
-<row>
-<entry><literal>23503</literal></entry>
-<entry>FOREIGN KEY VIOLATION</entry>
-<entry>foreign_key_violation</entry>
-</row>
-
-<row>
-<entry><literal>23505</literal></entry>
-<entry>UNIQUE VIOLATION</entry>
-<entry>unique_violation</entry>
-</row>
-
-<row>
-<entry><literal>23514</literal></entry>
-<entry>CHECK VIOLATION</entry>
-<entry>check_violation</entry>
-</row>
-
-<row>
-<entry><literal>23P01</literal></entry>
-<entry>EXCLUSION VIOLATION</entry>
-<entry>exclusion_violation</entry>
-</row>
-
-
-<row>
-<entry spanname="span13"><emphasis role="bold">Class 24 &mdash; Invalid Cursor State</></entry>
-</row>
-
-<row>
-<entry><literal>24000</literal></entry>
-<entry>INVALID CURSOR STATE</entry>
-<entry>invalid_cursor_state</entry>
-</row>
-
-
-<row>
-<entry spanname="span13"><emphasis role="bold">Class 25 &mdash; Invalid Transaction State</></entry>
-</row>
-
-<row>
-<entry><literal>25000</literal></entry>
-<entry>INVALID TRANSACTION STATE</entry>
-<entry>invalid_transaction_state</entry>
-</row>
-
-<row>
-<entry><literal>25001</literal></entry>
-<entry>ACTIVE SQL TRANSACTION</entry>
-<entry>active_sql_transaction</entry>
-</row>
-
-<row>
-<entry><literal>25002</literal></entry>
-<entry>BRANCH TRANSACTION ALREADY ACTIVE</entry>
-<entry>branch_transaction_already_active</entry>
-</row>
-
-<row>
-<entry><literal>25008</literal></entry>
-<entry>HELD CURSOR REQUIRES SAME ISOLATION LEVEL</entry>
-<entry>held_cursor_requires_same_isolation_level</entry>
-</row>
-
-<row>
-<entry><literal>25003</literal></entry>
-<entry>INAPPROPRIATE ACCESS MODE FOR BRANCH TRANSACTION</entry>
-<entry>inappropriate_access_mode_for_branch_transaction</entry>
-</row>
-
-<row>
-<entry><literal>25004</literal></entry>
-<entry>INAPPROPRIATE ISOLATION LEVEL FOR BRANCH TRANSACTION</entry>
-<entry>inappropriate_isolation_level_for_branch_transaction</entry>
-</row>
-
-<row>
-<entry><literal>25005</literal></entry>
-<entry>NO ACTIVE SQL TRANSACTION FOR BRANCH TRANSACTION</entry>
-<entry>no_active_sql_transaction_for_branch_transaction</entry>
-</row>
-
-<row>
-<entry><literal>25006</literal></entry>
-<entry>READ ONLY SQL TRANSACTION</entry>
-<entry>read_only_sql_transaction</entry>
-</row>
-
-<row>
-<entry><literal>25007</literal></entry>
-<entry>SCHEMA AND DATA STATEMENT MIXING NOT SUPPORTED</entry>
-<entry>schema_and_data_statement_mixing_not_supported</entry>
-</row>
-
-<row>
-<entry><literal>25P01</literal></entry>
-<entry>NO ACTIVE SQL TRANSACTION</entry>
-<entry>no_active_sql_transaction</entry>
-</row>
-
-<row>
-<entry><literal>25P02</literal></entry>
-<entry>IN FAILED SQL TRANSACTION</entry>
-<entry>in_failed_sql_transaction</entry>
-</row>
-
-
-<row>
-<entry spanname="span13"><emphasis role="bold">Class 26 &mdash; Invalid SQL Statement Name</></entry>
-</row>
-
-<row>
-<entry><literal>26000</literal></entry>
-<entry>INVALID SQL STATEMENT NAME</entry>
-<entry>invalid_sql_statement_name</entry>
-</row>
-
-
-<row>
-<entry spanname="span13"><emphasis role="bold">Class 27 &mdash; Triggered Data Change Violation</></entry>
-</row>
-
-<row>
-<entry><literal>27000</literal></entry>
-<entry>TRIGGERED DATA CHANGE VIOLATION</entry>
-<entry>triggered_data_change_violation</entry>
-</row>
-
-
-<row>
-<entry spanname="span13"><emphasis role="bold">Class 28 &mdash; Invalid Authorization Specification</></entry>
-</row>
-
-<row>
-<entry><literal>28000</literal></entry>
-<entry>INVALID AUTHORIZATION SPECIFICATION</entry>
-<entry>invalid_authorization_specification</entry>
-</row>
-
-<row>
-<entry><literal>28P01</literal></entry>
-<entry>INVALID PASSWORD</entry>
-<entry>invalid_password</entry>
-</row>
-
-
-<row>
-<entry spanname="span13"><emphasis role="bold">Class 2B &mdash; Dependent Privilege Descriptors Still Exist</></entry>
-</row>
-
-<row>
-<entry><literal>2B000</literal></entry>
-<entry>DEPENDENT PRIVILEGE DESCRIPTORS STILL EXIST</entry>
-<entry>dependent_privilege_descriptors_still_exist</entry>
-</row>
-
-<row>
-<entry><literal>2BP01</literal></entry>
-<entry>DEPENDENT OBJECTS STILL EXIST</entry>
-<entry>dependent_objects_still_exist</entry>
-</row>
-
-
-<row>
-<entry spanname="span13"><emphasis role="bold">Class 2D &mdash; Invalid Transaction Termination</></entry>
-</row>
-
-<row>
-<entry><literal>2D000</literal></entry>
-<entry>INVALID TRANSACTION TERMINATION</entry>
-<entry>invalid_transaction_termination</entry>
-</row>
-
-
-<row>
-<entry spanname="span13"><emphasis role="bold">Class 2F &mdash; SQL Routine Exception</></entry>
-</row>
-
-<row>
-<entry><literal>2F000</literal></entry>
-<entry>SQL ROUTINE EXCEPTION</entry>
-<entry>sql_routine_exception</entry>
-</row>
-
-<row>
-<entry><literal>2F005</literal></entry>
-<entry>FUNCTION EXECUTED NO RETURN STATEMENT</entry>
-<entry>function_executed_no_return_statement</entry>
-</row>
-
-<row>
-<entry><literal>2F002</literal></entry>
-<entry>MODIFYING SQL DATA NOT PERMITTED</entry>
-<entry>modifying_sql_data_not_permitted</entry>
-</row>
-
-<row>
-<entry><literal>2F003</literal></entry>
-<entry>PROHIBITED SQL STATEMENT ATTEMPTED</entry>
-<entry>prohibited_sql_statement_attempted</entry>
-</row>
-
-<row>
-<entry><literal>2F004</literal></entry>
-<entry>READING SQL DATA NOT PERMITTED</entry>
-<entry>reading_sql_data_not_permitted</entry>
-</row>
-
-
-<row>
-<entry spanname="span13"><emphasis role="bold">Class 34 &mdash; Invalid Cursor Name</></entry>
-</row>
-
-<row>
-<entry><literal>34000</literal></entry>
-<entry>INVALID CURSOR NAME</entry>
-<entry>invalid_cursor_name</entry>
-</row>
-
-
-<row>
-<entry spanname="span13"><emphasis role="bold">Class 38 &mdash; External Routine Exception</></entry>
-</row>
-
-<row>
-<entry><literal>38000</literal></entry>
-<entry>EXTERNAL ROUTINE EXCEPTION</entry>
-<entry>external_routine_exception</entry>
-</row>
-
-<row>
-<entry><literal>38001</literal></entry>
-<entry>CONTAINING SQL NOT PERMITTED</entry>
-<entry>containing_sql_not_permitted</entry>
-</row>
-
-<row>
-<entry><literal>38002</literal></entry>
-<entry>MODIFYING SQL DATA NOT PERMITTED</entry>
-<entry>modifying_sql_data_not_permitted</entry>
-</row>
-
-<row>
-<entry><literal>38003</literal></entry>
-<entry>PROHIBITED SQL STATEMENT ATTEMPTED</entry>
-<entry>prohibited_sql_statement_attempted</entry>
-</row>
-
-<row>
-<entry><literal>38004</literal></entry>
-<entry>READING SQL DATA NOT PERMITTED</entry>
-<entry>reading_sql_data_not_permitted</entry>
-</row>
-
-
-<row>
-<entry spanname="span13"><emphasis role="bold">Class 39 &mdash; External Routine Invocation Exception</></entry>
-</row>
-
-<row>
-<entry><literal>39000</literal></entry>
-<entry>EXTERNAL ROUTINE INVOCATION EXCEPTION</entry>
-<entry>external_routine_invocation_exception</entry>
-</row>
-
-<row>
-<entry><literal>39001</literal></entry>
-<entry>INVALID SQLSTATE RETURNED</entry>
-<entry>invalid_sqlstate_returned</entry>
-</row>
-
-<row>
-<entry><literal>39004</literal></entry>
-<entry>NULL VALUE NOT ALLOWED</entry>
-<entry>null_value_not_allowed</entry>
-</row>
-
-<row>
-<entry><literal>39P01</literal></entry>
-<entry>TRIGGER PROTOCOL VIOLATED</entry>
-<entry>trigger_protocol_violated</entry>
-</row>
-
-<row>
-<entry><literal>39P02</literal></entry>
-<entry>SRF PROTOCOL VIOLATED</entry>
-<entry>srf_protocol_violated</entry>
-</row>
-
-
-<row>
-<entry spanname="span13"><emphasis role="bold">Class 3B &mdash; Savepoint Exception</></entry>
-</row>
-
-<row>
-<entry><literal>3B000</literal></entry>
-<entry>SAVEPOINT EXCEPTION</entry>
-<entry>savepoint_exception</entry>
-</row>
-
-<row>
-<entry><literal>3B001</literal></entry>
-<entry>INVALID SAVEPOINT SPECIFICATION</entry>
-<entry>invalid_savepoint_specification</entry>
-</row>
-
-
-<row>
-<entry spanname="span13"><emphasis role="bold">Class 3D &mdash; Invalid Catalog Name</></entry>
-</row>
-
-<row>
-<entry><literal>3D000</literal></entry>
-<entry>INVALID CATALOG NAME</entry>
-<entry>invalid_catalog_name</entry>
-</row>
-
-
-<row>
-<entry spanname="span13"><emphasis role="bold">Class 3F &mdash; Invalid Schema Name</></entry>
-</row>
-
-<row>
-<entry><literal>3F000</literal></entry>
-<entry>INVALID SCHEMA NAME</entry>
-<entry>invalid_schema_name</entry>
-</row>
-
-
-<row>
-<entry spanname="span13"><emphasis role="bold">Class 40 &mdash; Transaction Rollback</></entry>
-</row>
-
-<row>
-<entry><literal>40000</literal></entry>
-<entry>TRANSACTION ROLLBACK</entry>
-<entry>transaction_rollback</entry>
-</row>
-
-<row>
-<entry><literal>40002</literal></entry>
-<entry>TRANSACTION INTEGRITY CONSTRAINT VIOLATION</entry>
-<entry>transaction_integrity_constraint_violation</entry>
-</row>
-
-<row>
-<entry><literal>40001</literal></entry>
-<entry>SERIALIZATION FAILURE</entry>
-<entry>serialization_failure</entry>
-</row>
-
-<row>
-<entry><literal>40003</literal></entry>
-<entry>STATEMENT COMPLETION UNKNOWN</entry>
-<entry>statement_completion_unknown</entry>
-</row>
-
-<row>
-<entry><literal>40P01</literal></entry>
-<entry>DEADLOCK DETECTED</entry>
-<entry>deadlock_detected</entry>
-</row>
-
-
-<row>
-<entry spanname="span13"><emphasis role="bold">Class 42 &mdash; Syntax Error or Access Rule Violation</></entry>
-</row>
-
-<row>
-<entry><literal>42000</literal></entry>
-<entry>SYNTAX ERROR OR ACCESS RULE VIOLATION</entry>
-<entry>syntax_error_or_access_rule_violation</entry>
-</row>
-
-<row>
-<entry><literal>42601</literal></entry>
-<entry>SYNTAX ERROR</entry>
-<entry>syntax_error</entry>
-</row>
-
-<row>
-<entry><literal>42501</literal></entry>
-<entry>INSUFFICIENT PRIVILEGE</entry>
-<entry>insufficient_privilege</entry>
-</row>
-
-<row>
-<entry><literal>42846</literal></entry>
-<entry>CANNOT COERCE</entry>
-<entry>cannot_coerce</entry>
-</row>
-
-<row>
-<entry><literal>42803</literal></entry>
-<entry>GROUPING ERROR</entry>
-<entry>grouping_error</entry>
-</row>
-
-<row>
-<entry><literal>42P20</literal></entry>
-<entry>WINDOWING ERROR</entry>
-<entry>windowing_error</entry>
-</row>
-
-<row>
-<entry><literal>42P19</literal></entry>
-<entry>INVALID RECURSION</entry>
-<entry>invalid_recursion</entry>
-</row>
-
-<row>
-<entry><literal>42830</literal></entry>
-<entry>INVALID FOREIGN KEY</entry>
-<entry>invalid_foreign_key</entry>
-</row>
-
-<row>
-<entry><literal>42602</literal></entry>
-<entry>INVALID NAME</entry>
-<entry>invalid_name</entry>
-</row>
-
-<row>
-<entry><literal>42622</literal></entry>
-<entry>NAME TOO LONG</entry>
-<entry>name_too_long</entry>
-</row>
-
-<row>
-<entry><literal>42939</literal></entry>
-<entry>RESERVED NAME</entry>
-<entry>reserved_name</entry>
-</row>
-
-<row>
-<entry><literal>42804</literal></entry>
-<entry>DATATYPE MISMATCH</entry>
-<entry>datatype_mismatch</entry>
-</row>
-
-<row>
-<entry><literal>42P18</literal></entry>
-<entry>INDETERMINATE DATATYPE</entry>
-<entry>indeterminate_datatype</entry>
-</row>
-
-<row>
-<entry><literal>42809</literal></entry>
-<entry>WRONG OBJECT TYPE</entry>
-<entry>wrong_object_type</entry>
-</row>
-
-<row>
-<entry><literal>42703</literal></entry>
-<entry>UNDEFINED COLUMN</entry>
-<entry>undefined_column</entry>
-</row>
-
-<row>
-<entry><literal>42883</literal></entry>
-<entry>UNDEFINED FUNCTION</entry>
-<entry>undefined_function</entry>
-</row>
-
-<row>
-<entry><literal>42P01</literal></entry>
-<entry>UNDEFINED TABLE</entry>
-<entry>undefined_table</entry>
-</row>
-
-<row>
-<entry><literal>42P02</literal></entry>
-<entry>UNDEFINED PARAMETER</entry>
-<entry>undefined_parameter</entry>
-</row>
-
-<row>
-<entry><literal>42704</literal></entry>
-<entry>UNDEFINED OBJECT</entry>
-<entry>undefined_object</entry>
-</row>
-
-<row>
-<entry><literal>42701</literal></entry>
-<entry>DUPLICATE COLUMN</entry>
-<entry>duplicate_column</entry>
-</row>
-
-<row>
-<entry><literal>42P03</literal></entry>
-<entry>DUPLICATE CURSOR</entry>
-<entry>duplicate_cursor</entry>
-</row>
-
-<row>
-<entry><literal>42P04</literal></entry>
-<entry>DUPLICATE DATABASE</entry>
-<entry>duplicate_database</entry>
-</row>
-
-<row>
-<entry><literal>42723</literal></entry>
-<entry>DUPLICATE FUNCTION</entry>
-<entry>duplicate_function</entry>
-</row>
-
-<row>
-<entry><literal>42P05</literal></entry>
-<entry>DUPLICATE PREPARED STATEMENT</entry>
-<entry>duplicate_prepared_statement</entry>
-</row>
-
-<row>
-<entry><literal>42P06</literal></entry>
-<entry>DUPLICATE SCHEMA</entry>
-<entry>duplicate_schema</entry>
-</row>
-
-<row>
-<entry><literal>42P07</literal></entry>
-<entry>DUPLICATE TABLE</entry>
-<entry>duplicate_table</entry>
-</row>
-
-<row>
-<entry><literal>42712</literal></entry>
-<entry>DUPLICATE ALIAS</entry>
-<entry>duplicate_alias</entry>
-</row>
-
-<row>
-<entry><literal>42710</literal></entry>
-<entry>DUPLICATE OBJECT</entry>
-<entry>duplicate_object</entry>
-</row>
-
-<row>
-<entry><literal>42702</literal></entry>
-<entry>AMBIGUOUS COLUMN</entry>
-<entry>ambiguous_column</entry>
-</row>
-
-<row>
-<entry><literal>42725</literal></entry>
-<entry>AMBIGUOUS FUNCTION</entry>
-<entry>ambiguous_function</entry>
-</row>
-
-<row>
-<entry><literal>42P08</literal></entry>
-<entry>AMBIGUOUS PARAMETER</entry>
-<entry>ambiguous_parameter</entry>
-</row>
-
-<row>
-<entry><literal>42P09</literal></entry>
-<entry>AMBIGUOUS ALIAS</entry>
-<entry>ambiguous_alias</entry>
-</row>
-
-<row>
-<entry><literal>42P10</literal></entry>
-<entry>INVALID COLUMN REFERENCE</entry>
-<entry>invalid_column_reference</entry>
-</row>
-
-<row>
-<entry><literal>42611</literal></entry>
-<entry>INVALID COLUMN DEFINITION</entry>
-<entry>invalid_column_definition</entry>
-</row>
-
-<row>
-<entry><literal>42P11</literal></entry>
-<entry>INVALID CURSOR DEFINITION</entry>
-<entry>invalid_cursor_definition</entry>
-</row>
-
-<row>
-<entry><literal>42P12</literal></entry>
-<entry>INVALID DATABASE DEFINITION</entry>
-<entry>invalid_database_definition</entry>
-</row>
-
-<row>
-<entry><literal>42P13</literal></entry>
-<entry>INVALID FUNCTION DEFINITION</entry>
-<entry>invalid_function_definition</entry>
-</row>
-
-<row>
-<entry><literal>42P14</literal></entry>
-<entry>INVALID PREPARED STATEMENT DEFINITION</entry>
-<entry>invalid_prepared_statement_definition</entry>
-</row>
-
-<row>
-<entry><literal>42P15</literal></entry>
-<entry>INVALID SCHEMA DEFINITION</entry>
-<entry>invalid_schema_definition</entry>
-</row>
-
-<row>
-<entry><literal>42P16</literal></entry>
-<entry>INVALID TABLE DEFINITION</entry>
-<entry>invalid_table_definition</entry>
-</row>
-
-<row>
-<entry><literal>42P17</literal></entry>
-<entry>INVALID OBJECT DEFINITION</entry>
-<entry>invalid_object_definition</entry>
-</row>
-
-
-<row>
-<entry spanname="span13"><emphasis role="bold">Class 44 &mdash; WITH CHECK OPTION Violation</></entry>
-</row>
-
-<row>
-<entry><literal>44000</literal></entry>
-<entry>WITH CHECK OPTION VIOLATION</entry>
-<entry>with_check_option_violation</entry>
-</row>
-
-
-<row>
-<entry spanname="span13"><emphasis role="bold">Class 53 &mdash; Insufficient Resources</></entry>
-</row>
-
-<row>
-<entry><literal>53000</literal></entry>
-<entry>INSUFFICIENT RESOURCES</entry>
-<entry>insufficient_resources</entry>
-</row>
-
-<row>
-<entry><literal>53100</literal></entry>
-<entry>DISK FULL</entry>
-<entry>disk_full</entry>
-</row>
-
-<row>
-<entry><literal>53200</literal></entry>
-<entry>OUT OF MEMORY</entry>
-<entry>out_of_memory</entry>
-</row>
-
-<row>
-<entry><literal>53300</literal></entry>
-<entry>TOO MANY CONNECTIONS</entry>
-<entry>too_many_connections</entry>
-</row>
-
-
-<row>
-<entry spanname="span13"><emphasis role="bold">Class 54 &mdash; Program Limit Exceeded</></entry>
-</row>
-
-<row>
-<entry><literal>54000</literal></entry>
-<entry>PROGRAM LIMIT EXCEEDED</entry>
-<entry>program_limit_exceeded</entry>
-</row>
-
-<row>
-<entry><literal>54001</literal></entry>
-<entry>STATEMENT TOO COMPLEX</entry>
-<entry>statement_too_complex</entry>
-</row>
-
-<row>
-<entry><literal>54011</literal></entry>
-<entry>TOO MANY COLUMNS</entry>
-<entry>too_many_columns</entry>
-</row>
-
-<row>
-<entry><literal>54023</literal></entry>
-<entry>TOO MANY ARGUMENTS</entry>
-<entry>too_many_arguments</entry>
-</row>
-
-
-<row>
-<entry spanname="span13"><emphasis role="bold">Class 55 &mdash; Object Not In Prerequisite State</></entry>
-</row>
-
-<row>
-<entry><literal>55000</literal></entry>
-<entry>OBJECT NOT IN PREREQUISITE STATE</entry>
-<entry>object_not_in_prerequisite_state</entry>
-</row>
-
-<row>
-<entry><literal>55006</literal></entry>
-<entry>OBJECT IN USE</entry>
-<entry>object_in_use</entry>
-</row>
-
-<row>
-<entry><literal>55P02</literal></entry>
-<entry>CANT CHANGE RUNTIME PARAM</entry>
-<entry>cant_change_runtime_param</entry>
-</row>
-
-<row>
-<entry><literal>55P03</literal></entry>
-<entry>LOCK NOT AVAILABLE</entry>
-<entry>lock_not_available</entry>
-</row>
-
-
-<row>
-<entry spanname="span13"><emphasis role="bold">Class 57 &mdash; Operator Intervention</></entry>
-</row>
-
-<row>
-<entry><literal>57000</literal></entry>
-<entry>OPERATOR INTERVENTION</entry>
-<entry>operator_intervention</entry>
-</row>
-
-<row>
-<entry><literal>57014</literal></entry>
-<entry>QUERY CANCELED</entry>
-<entry>query_canceled</entry>
-</row>
-
-<row>
-<entry><literal>57P01</literal></entry>
-<entry>ADMIN SHUTDOWN</entry>
-<entry>admin_shutdown</entry>
-</row>
-
-<row>
-<entry><literal>57P02</literal></entry>
-<entry>CRASH SHUTDOWN</entry>
-<entry>crash_shutdown</entry>
-</row>
-
-<row>
-<entry><literal>57P03</literal></entry>
-<entry>CANNOT CONNECT NOW</entry>
-<entry>cannot_connect_now</entry>
-</row>
-
-<row>
-<entry><literal>57P04</literal></entry>
-<entry>DATABASE DROPPED</entry>
-<entry>database_dropped</entry>
-</row>
-
-
-<row>
-<entry spanname="span13"><emphasis role="bold">Class 58 &mdash; System Error (errors external to <productname>PostgreSQL</> itself)</></entry>
-</row>
-
-<row>
-<entry><literal>58030</literal></entry>
-<entry>IO ERROR</entry>
-<entry>io_error</entry>
-</row>
-
-<row>
-<entry><literal>58P01</literal></entry>
-<entry>UNDEFINED FILE</entry>
-<entry>undefined_file</entry>
-</row>
-
-<row>
-<entry><literal>58P02</literal></entry>
-<entry>DUPLICATE FILE</entry>
-<entry>duplicate_file</entry>
-</row>
-
-
-<row>
-<entry spanname="span13"><emphasis role="bold">Class F0 &mdash; Configuration File Error</></entry>
-</row>
-
-<row>
-<entry><literal>F0000</literal></entry>
-<entry>CONFIG FILE ERROR</entry>
-<entry>config_file_error</entry>
-</row>
-
-<row>
-<entry><literal>F0001</literal></entry>
-<entry>LOCK FILE EXISTS</entry>
-<entry>lock_file_exists</entry>
-</row>
-
-
-<row>
-<entry spanname="span13"><emphasis role="bold">Class HV &mdash; Foreign Data Wrapper Error (SQL/MED)</></entry>
-</row>
-
-<row>
-<entry><literal>HV000</literal></entry>
-<entry>FDW ERROR</entry>
-<entry>fdw_error</entry>
-</row>
-
-<row>
-<entry><literal>HV005</literal></entry>
-<entry>FDW COLUMN NAME NOT FOUND</entry>
-<entry>fdw_column_name_not_found</entry>
-</row>
-
-<row>
-<entry><literal>HV002</literal></entry>
-<entry>FDW DYNAMIC PARAMETER VALUE NEEDED</entry>
-<entry>fdw_dynamic_parameter_value_needed</entry>
-</row>
-
-<row>
-<entry><literal>HV010</literal></entry>
-<entry>FDW FUNCTION SEQUENCE ERROR</entry>
-<entry>fdw_function_sequence_error</entry>
-</row>
-
-<row>
-<entry><literal>HV021</literal></entry>
-<entry>FDW INCONSISTENT DESCRIPTOR INFORMATION</entry>
-<entry>fdw_inconsistent_descriptor_information</entry>
-</row>
-
-<row>
-<entry><literal>HV024</literal></entry>
-<entry>FDW INVALID ATTRIBUTE VALUE</entry>
-<entry>fdw_invalid_attribute_value</entry>
-</row>
-
-<row>
-<entry><literal>HV007</literal></entry>
-<entry>FDW INVALID COLUMN NAME</entry>
-<entry>fdw_invalid_column_name</entry>
-</row>
-
-<row>
-<entry><literal>HV008</literal></entry>
-<entry>FDW INVALID COLUMN NUMBER</entry>
-<entry>fdw_invalid_column_number</entry>
-</row>
-
-<row>
-<entry><literal>HV004</literal></entry>
-<entry>FDW INVALID DATA TYPE</entry>
-<entry>fdw_invalid_data_type</entry>
-</row>
-
-<row>
-<entry><literal>HV006</literal></entry>
-<entry>FDW INVALID DATA TYPE DESCRIPTORS</entry>
-<entry>fdw_invalid_data_type_descriptors</entry>
-</row>
-
-<row>
-<entry><literal>HV091</literal></entry>
-<entry>FDW INVALID DESCRIPTOR FIELD IDENTIFIER</entry>
-<entry>fdw_invalid_descriptor_field_identifier</entry>
-</row>
-
-<row>
-<entry><literal>HV00B</literal></entry>
-<entry>FDW INVALID HANDLE</entry>
-<entry>fdw_invalid_handle</entry>
-</row>
-
-<row>
-<entry><literal>HV00C</literal></entry>
-<entry>FDW INVALID OPTION INDEX</entry>
-<entry>fdw_invalid_option_index</entry>
-</row>
-
-<row>
-<entry><literal>HV00D</literal></entry>
-<entry>FDW INVALID OPTION NAME</entry>
-<entry>fdw_invalid_option_name</entry>
-</row>
-
-<row>
-<entry><literal>HV090</literal></entry>
-<entry>FDW INVALID STRING LENGTH OR BUFFER LENGTH</entry>
-<entry>fdw_invalid_string_length_or_buffer_length</entry>
-</row>
-
-<row>
-<entry><literal>HV00A</literal></entry>
-<entry>FDW INVALID STRING FORMAT</entry>
-<entry>fdw_invalid_string_format</entry>
-</row>
-
-<row>
-<entry><literal>HV009</literal></entry>
-<entry>FDW INVALID USE OF NULL POINTER</entry>
-<entry>fdw_invalid_use_of_null_pointer</entry>
-</row>
-
-<row>
-<entry><literal>HV014</literal></entry>
-<entry>FDW TOO MANY HANDLES</entry>
-<entry>fdw_too_many_handles</entry>
-</row>
-
-<row>
-<entry><literal>HV001</literal></entry>
-<entry>FDW OUT OF MEMORY</entry>
-<entry>fdw_out_of_memory</entry>
-</row>
-
-<row>
-<entry><literal>HV00P</literal></entry>
-<entry>FDW NO SCHEMAS</entry>
-<entry>fdw_no_schemas</entry>
-</row>
-
-<row>
-<entry><literal>HV00J</literal></entry>
-<entry>FDW OPTION NAME NOT FOUND</entry>
-<entry>fdw_option_name_not_found</entry>
-</row>
-
-<row>
-<entry><literal>HV00K</literal></entry>
-<entry>FDW REPLY HANDLE</entry>
-<entry>fdw_reply_handle</entry>
-</row>
-
-<row>
-<entry><literal>HV00Q</literal></entry>
-<entry>FDW SCHEMA NOT FOUND</entry>
-<entry>fdw_schema_not_found</entry>
-</row>
-
-<row>
-<entry><literal>HV00R</literal></entry>
-<entry>FDW TABLE NOT FOUND</entry>
-<entry>fdw_table_not_found</entry>
-</row>
-
-<row>
-<entry><literal>HV00L</literal></entry>
-<entry>FDW UNABLE TO CREATE EXECUTION</entry>
-<entry>fdw_unable_to_create_execution</entry>
-</row>
-
-<row>
-<entry><literal>HV00M</literal></entry>
-<entry>FDW UNABLE TO CREATE REPLY</entry>
-<entry>fdw_unable_to_create_reply</entry>
-</row>
-
-<row>
-<entry><literal>HV00N</literal></entry>
-<entry>FDW UNABLE TO ESTABLISH CONNECTION</entry>
-<entry>fdw_unable_to_establish_connection</entry>
-</row>
-
-
-<row>
-<entry spanname="span13"><emphasis role="bold">Class P0 &mdash; PL/pgSQL Error</></entry>
-</row>
-
-<row>
-<entry><literal>P0000</literal></entry>
-<entry>PLPGSQL ERROR</entry>
-<entry>plpgsql_error</entry>
-</row>
-
-<row>
-<entry><literal>P0001</literal></entry>
-<entry>RAISE EXCEPTION</entry>
-<entry>raise_exception</entry>
-</row>
-
-<row>
-<entry><literal>P0002</literal></entry>
-<entry>NO DATA FOUND</entry>
-<entry>no_data_found</entry>
-</row>
-
-<row>
-<entry><literal>P0003</literal></entry>
-<entry>TOO MANY ROWS</entry>
-<entry>too_many_rows</entry>
-</row>
-
-
-<row>
-<entry spanname="span13"><emphasis role="bold">Class XX &mdash; Internal Error</></entry>
-</row>
-
-<row>
-<entry><literal>XX000</literal></entry>
-<entry>INTERNAL ERROR</entry>
-<entry>internal_error</entry>
-</row>
-
-<row>
-<entry><literal>XX001</literal></entry>
-<entry>DATA CORRUPTED</entry>
-<entry>data_corrupted</entry>
-</row>
-
-<row>
-<entry><literal>XX002</literal></entry>
-<entry>INDEX CORRUPTED</entry>
-<entry>index_corrupted</entry>
-</row>
+    &errcodes-table;
 
   </tbody>
  </tgroup>
index 99437ac37896a2179a61330caa5e1704aafb3190..b9d4ea59b1aaa2f5eef02289ab9b937ad9ee1213 100644 (file)
 <!entity features-supported   SYSTEM "features-supported.sgml">
 <!entity features-unsupported SYSTEM "features-unsupported.sgml">
 
+<!entity errcodes-table SYSTEM "errcodes-table.sgml">
+
 <!-- back matter -->
 <!entity biblio     SYSTEM "biblio.sgml">
 <!entity bookindex  SYSTEM "bookindex.sgml">
diff --git a/doc/src/sgml/generate-errcodes-table.pl b/doc/src/sgml/generate-errcodes-table.pl
new file mode 100644 (file)
index 0000000..5d0ccff
--- /dev/null
@@ -0,0 +1,63 @@
+#!/usr/bin/perl
+#
+# Generate the errcodes-table.sgml file from errcodes.txt
+# Copyright (c) 2000-2011, PostgreSQL Global Development Group
+
+use warnings;
+use strict;
+
+print "<!-- autogenerated from src/backend/utils/errcodes.txt, do not edit -->\n";
+
+open my $errcodes, $ARGV[0] or die;
+
+while (<$errcodes>) {
+    chomp;
+
+    # Skip comments
+    next if /^#/;
+    next if /^\s*$/;
+
+    # Emit section headers
+    if (/^Section:/) {
+
+       # Remove the Section: string
+       s/^Section: //;
+       # Escape dashes for SGML
+       s/-/&mdash;/;
+       # Wrap PostgreSQL in <productname/>
+       s/PostgreSQL/<productname>PostgreSQL<\/>/g;
+
+       print "\n\n";
+       print "<row>\n";
+       print "<entry spanname=\"span13\">";
+       print "<emphasis role=\"bold\">$_</></entry>\n";
+       print "</row>\n";
+
+       next;
+    }
+
+    die unless /^([^\s]{5})\s+([EWS])\s+([^\s]+)(?:\s+)?([^\s]+)?/;
+
+    (my $sqlstate,
+     my $type,
+     my $errcode_macro,
+     my $condition_name) = ($1, $2, $3, $4);
+
+    # Skip lines without PL/pgSQL condition names
+    next unless defined($condition_name);
+
+    my $meaning = $condition_name;
+    # Remove underscores
+    $meaning =~ s/_/ /g;
+    # And capitalize
+    $meaning =~ tr/[a-z]/[A-Z]/;
+
+    print "\n";
+    print "<row>\n";
+    print "<entry><literal>$sqlstate</literal></entry>\n";
+    print "<entry>$meaning</entry>\n";
+    print "<entry>$condition_name</entry>\n";
+    print "</row>\n";
+}
+
+close $errcodes;
index 4469d2cdf2c004e178d9b9d3c268e913224c4a93..0aad44c0baccc5a92f20d8b9f87eada1beeb95dd 100644 (file)
@@ -30,6 +30,17 @@ SUBDIRS = \
 # don't attempt parallel make here.
 .NOTPARALLEL:
 
+# generate errcodes.h before recursing in the subdirectories
+$(SUBDIRS:%=all-%-recurse): $(top_builddir)/src/include/utils/errcodes.h
+
+backend/utils/errcodes.h: backend/utils/generate-errcodes.pl $(top_srcdir)/src/backend/utils/errcodes.txt
+       $(MAKE) -C backend/utils errcodes.h
+
+$(top_builddir)/src/include/utils/errcodes.h: backend/utils/errcodes.h
+       prereqdir=`cd $(dir $<) >/dev/null && pwd` && \
+         cd $(dir $@) && rm -f $(notdir $@) && \
+         $(LN_S) "$$prereqdir/$(notdir $<)" .
+
 $(recurse)
 
 install: install-local
index bb43526fece0c9f2cd522331688d580d68e93015..7e619326d231da9c6777702b03d0954bfb60d749 100644 (file)
@@ -298,6 +298,7 @@ maintainer-clean: distclean
              catalog/postgres.shdescription \
              utils/fmgroids.h \
              utils/fmgrtab.c \
+             utils/errcodes.h \
              utils/misc/guc-file.c
 
 
index fd00851e4a706ac60ceb4f11a01416a50c26f396..5c3a565ba0ba72185773c49966d045bafaf90369 100644 (file)
@@ -1,3 +1,4 @@
 /fmgrtab.c
 /fmgroids.h
 /probes.h
+/errcodes.h
index 0f171d012811a3c46bdda088db13117b6b5812b2..fcd8138f3e52c66d848edfada007611332f1c6e7 100644 (file)
@@ -26,6 +26,9 @@ fmgroids.h: fmgrtab.c ;
 fmgrtab.c: Gen_fmgrtab.pl $(catalogdir)/Catalog.pm $(top_srcdir)/src/include/catalog/pg_proc.h
        $(PERL) -I $(catalogdir) $< $(top_srcdir)/src/include/catalog/pg_proc.h
 
+errcodes.h: $(top_srcdir)/src/backend/utils/errcodes.txt generate-errcodes.pl
+       $(PERL) generate-errcodes.pl $< > $@
+
 ifneq ($(enable_dtrace), yes)
 probes.h: Gen_dummy_probes.sed
 endif
@@ -40,10 +43,10 @@ else
 endif
 
 
-# fmgroids.h and fmgrtab.c are in the distribution tarball, so they
+# fmgroids.h, fmgrtab.c and errcodes.h are in the distribution tarball, so they
 # are not cleaned here.
 clean:
        rm -f probes.h
 
 maintainer-clean: clean
-       rm -f fmgroids.h fmgrtab.c
+       rm -f fmgroids.h fmgrtab.c errcodes.h
diff --git a/src/backend/utils/errcodes.txt b/src/backend/utils/errcodes.txt
new file mode 100644 (file)
index 0000000..7d5523d
--- /dev/null
@@ -0,0 +1,452 @@
+#
+# errcodes.txt
+#      PostgreSQL error codes
+#
+#
+# This list serves a basis for generating source files containing error
+# codes. It is kept in a common format to make sure all these source files have
+# the same contents.
+# The files generated from this one are:
+#
+#   src/include/utils/errcodes.h
+#      macros defining errcode constants to be used in the rest of the source
+#
+#   src/pl/plpgsql/src/plerrcodes.h
+#      a list of PL/pgSQL condition names and their SQLSTATE codes
+#
+#   doc/src/sgml/errcodes-list.sgml
+#      a SGML table of error codes for inclusion in the documentation
+#
+# The format of this file is one error code per line, with the following
+# whitespace-separated fields:
+#
+#      sqlstate    E/W/S    errcode_macro_name    spec_name
+#
+# where sqlstate is a five-character string following the SQLSTATE conventions,
+# the second field determines if the code means an error, a warning or success,
+# errcode_macro_name is the C macro name starting with ERRCODE that will be put
+# in errcodes.h and spec_name is a lowercase, underscore-separated name that
+# will be used as the PL/pgSQL condition name and will also be included in the
+# SGML list. The last field is optional, if not present the PL/pgSQL condition
+# and the SGML entry will not be generated.
+#
+# Empty lines and ones starting with a hash are comments.
+#
+# There are also special lines in the format of:
+#
+#      Section: section description
+#
+# that is, lines starting with the string "Section:". They are used to delimit
+# error classes as defined in the SQL spec, and are necessary for SGML output.
+#
+#
+#      SQLSTATE codes for errors.
+#
+# The SQL99 code set is rather impoverished, especially in the area of
+# syntactical and semantic errors.  We have borrowed codes from IBM's DB2
+# and invented our own codes to develop a useful code set.
+#
+# When adding a new code, make sure it is placed in the most appropriate
+# class (the first two characters of the code value identify the class).
+# The listing is organized by class to make this prominent.
+#
+# The generic '000' subclass code should be used for an error only
+# when there is not a more-specific subclass code defined.
+#
+# The SQL spec requires that all the elements of a SQLSTATE code be
+# either digits or upper-case ASCII characters.
+#
+# Classes that begin with 0-4 or A-H are defined by the
+# standard. Within such a class, subclass values defined by the
+# standard must begin with 0-4 or A-H. To define a new error code,
+# ensure that it is either in an "implementation-defined class" (it
+# begins with 5-9 or I-Z), or its subclass falls outside the range of
+# error codes that could be present in future versions of the
+# standard (i.e. the subclass value begins with 5-9 or I-Z).
+#
+# The convention is that new error codes defined by PostgreSQL in a
+# class defined by the standard have a subclass value that begins
+# with 'P'. In addition, error codes defined by PostgreSQL clients
+# (such as ecpg) have a class value that begins with 'Y'.
+
+Section: Class 00 - Successful Completion
+
+00000    S    ERRCODE_SUCCESSFUL_COMPLETION                                  successful_completion
+
+Section: Class 01 - Warning
+
+# do not use this class for failure conditions
+01000    W    ERRCODE_WARNING                                                warning
+0100C    W    ERRCODE_WARNING_DYNAMIC_RESULT_SETS_RETURNED                   dynamic_result_sets_returned
+01008    W    ERRCODE_WARNING_IMPLICIT_ZERO_BIT_PADDING                      implicit_zero_bit_padding
+01003    W    ERRCODE_WARNING_NULL_VALUE_ELIMINATED_IN_SET_FUNCTION          null_value_eliminated_in_set_function
+01007    W    ERRCODE_WARNING_PRIVILEGE_NOT_GRANTED                          privilege_not_granted
+01006    W    ERRCODE_WARNING_PRIVILEGE_NOT_REVOKED                          privilege_not_revoked
+01004    W    ERRCODE_WARNING_STRING_DATA_RIGHT_TRUNCATION                   string_data_right_truncation
+01P01    W    ERRCODE_WARNING_DEPRECATED_FEATURE                             deprecated_feature
+
+Section: Class 02 - No Data (this is also a warning class per the SQL standard)
+
+# do not use this class for failure conditions
+02000    W    ERRCODE_NO_DATA                                                no_data
+02001    W    ERRCODE_NO_ADDITIONAL_DYNAMIC_RESULT_SETS_RETURNED             no_additional_dynamic_result_sets_returned
+
+Section: Class 03 - SQL Statement Not Yet Complete
+
+03000    E    ERRCODE_SQL_STATEMENT_NOT_YET_COMPLETE                         sql_statement_not_yet_complete
+
+Section: Class 08 - Connection Exception
+
+08000    E    ERRCODE_CONNECTION_EXCEPTION                                   connection_exception
+08003    E    ERRCODE_CONNECTION_DOES_NOT_EXIST                              connection_does_not_exist
+08006    E    ERRCODE_CONNECTION_FAILURE                                     connection_failure
+08001    E    ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION            sqlclient_unable_to_establish_sqlconnection
+08004    E    ERRCODE_SQLSERVER_REJECTED_ESTABLISHMENT_OF_SQLCONNECTION      sqlserver_rejected_establishment_of_sqlconnection
+08007    E    ERRCODE_TRANSACTION_RESOLUTION_UNKNOWN                         transaction_resolution_unknown
+08P01    E    ERRCODE_PROTOCOL_VIOLATION                                     protocol_violation
+
+Section: Class 09 - Triggered Action Exception
+
+09000    E    ERRCODE_TRIGGERED_ACTION_EXCEPTION                             triggered_action_exception
+
+Section: Class 0A - Feature Not Supported
+
+0A000    E    ERRCODE_FEATURE_NOT_SUPPORTED                                  feature_not_supported
+
+Section: Class 0B - Invalid Transaction Initiation
+
+0B000    E    ERRCODE_INVALID_TRANSACTION_INITIATION                         invalid_transaction_initiation
+
+Section: Class 0F - Locator Exception
+
+0F000    E    ERRCODE_LOCATOR_EXCEPTION                                      locator_exception
+0F001    E    ERRCODE_L_E_INVALID_SPECIFICATION                              invalid_locator_specification
+
+Section: Class 0L - Invalid Grantor
+
+0L000    E    ERRCODE_INVALID_GRANTOR                                        invalid_grantor
+0LP01    E    ERRCODE_INVALID_GRANT_OPERATION                                invalid_grant_operation
+
+Section: Class 0P - Invalid Role Specification
+
+0P000    E    ERRCODE_INVALID_ROLE_SPECIFICATION                             invalid_role_specification
+
+Section: Class 20 - Case Not Found
+
+20000    E    ERRCODE_CASE_NOT_FOUND                                         case_not_found
+
+Section: Class 21 - Cardinality Violation
+
+# this means something returned the wrong number of rows
+21000    E    ERRCODE_CARDINALITY_VIOLATION                                  cardinality_violation
+
+Section: Class 22 - Data Exception
+
+22000    E    ERRCODE_DATA_EXCEPTION                                         data_exception
+2202E    E    ERRCODE_ARRAY_ELEMENT_ERROR
+# SQL99's actual definition of "array element error" is subscript error
+2202E    E    ERRCODE_ARRAY_SUBSCRIPT_ERROR                                  array_subscript_error
+22021    E    ERRCODE_CHARACTER_NOT_IN_REPERTOIRE                            character_not_in_repertoire
+22008    E    ERRCODE_DATETIME_FIELD_OVERFLOW                                datetime_field_overflow
+22008    E    ERRCODE_DATETIME_VALUE_OUT_OF_RANGE
+22012    E    ERRCODE_DIVISION_BY_ZERO                                       division_by_zero
+22005    E    ERRCODE_ERROR_IN_ASSIGNMENT                                    error_in_assignment
+2200B    E    ERRCODE_ESCAPE_CHARACTER_CONFLICT                              escape_character_conflict
+22022    E    ERRCODE_INDICATOR_OVERFLOW                                     indicator_overflow
+22015    E    ERRCODE_INTERVAL_FIELD_OVERFLOW                                interval_field_overflow
+2201E    E    ERRCODE_INVALID_ARGUMENT_FOR_LOG                               invalid_argument_for_logarithm
+22014    E    ERRCODE_INVALID_ARGUMENT_FOR_NTILE                             invalid_argument_for_ntile_function
+22016    E    ERRCODE_INVALID_ARGUMENT_FOR_NTH_VALUE                         invalid_argument_for_nth_value_function
+2201F    E    ERRCODE_INVALID_ARGUMENT_FOR_POWER_FUNCTION                    invalid_argument_for_power_function
+2201G    E    ERRCODE_INVALID_ARGUMENT_FOR_WIDTH_BUCKET_FUNCTION             invalid_argument_for_width_bucket_function
+22018    E    ERRCODE_INVALID_CHARACTER_VALUE_FOR_CAST                       invalid_character_value_for_cast
+22007    E    ERRCODE_INVALID_DATETIME_FORMAT                                invalid_datetime_format
+22019    E    ERRCODE_INVALID_ESCAPE_CHARACTER                               invalid_escape_character
+2200D    E    ERRCODE_INVALID_ESCAPE_OCTET                                   invalid_escape_octet
+22025    E    ERRCODE_INVALID_ESCAPE_SEQUENCE                                invalid_escape_sequence
+22P06    E    ERRCODE_NONSTANDARD_USE_OF_ESCAPE_CHARACTER                    nonstandard_use_of_escape_character
+22010    E    ERRCODE_INVALID_INDICATOR_PARAMETER_VALUE                      invalid_indicator_parameter_value
+22023    E    ERRCODE_INVALID_PARAMETER_VALUE                                invalid_parameter_value
+2201B    E    ERRCODE_INVALID_REGULAR_EXPRESSION                             invalid_regular_expression
+2201W    E    ERRCODE_INVALID_ROW_COUNT_IN_LIMIT_CLAUSE                      invalid_row_count_in_limit_clause
+2201X    E    ERRCODE_INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE              invalid_row_count_in_result_offset_clause
+22009    E    ERRCODE_INVALID_TIME_ZONE_DISPLACEMENT_VALUE                   invalid_time_zone_displacement_value
+2200C    E    ERRCODE_INVALID_USE_OF_ESCAPE_CHARACTER                        invalid_use_of_escape_character
+2200G    E    ERRCODE_MOST_SPECIFIC_TYPE_MISMATCH                            most_specific_type_mismatch
+22004    E    ERRCODE_NULL_VALUE_NOT_ALLOWED                                 null_value_not_allowed
+22002    E    ERRCODE_NULL_VALUE_NO_INDICATOR_PARAMETER                      null_value_no_indicator_parameter
+22003    E    ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE                             numeric_value_out_of_range
+22026    E    ERRCODE_STRING_DATA_LENGTH_MISMATCH                            string_data_length_mismatch
+22001    E    ERRCODE_STRING_DATA_RIGHT_TRUNCATION                           string_data_right_truncation
+22011    E    ERRCODE_SUBSTRING_ERROR                                        substring_error
+22027    E    ERRCODE_TRIM_ERROR                                             trim_error
+22024    E    ERRCODE_UNTERMINATED_C_STRING                                  unterminated_c_string
+2200F    E    ERRCODE_ZERO_LENGTH_CHARACTER_STRING                           zero_length_character_string
+22P01    E    ERRCODE_FLOATING_POINT_EXCEPTION                               floating_point_exception
+22P02    E    ERRCODE_INVALID_TEXT_REPRESENTATION                            invalid_text_representation
+22P03    E    ERRCODE_INVALID_BINARY_REPRESENTATION                          invalid_binary_representation
+22P04    E    ERRCODE_BAD_COPY_FILE_FORMAT                                   bad_copy_file_format
+22P05    E    ERRCODE_UNTRANSLATABLE_CHARACTER                               untranslatable_character
+2200L    E    ERRCODE_NOT_AN_XML_DOCUMENT                                    not_an_xml_document
+2200M    E    ERRCODE_INVALID_XML_DOCUMENT                                   invalid_xml_document
+2200N    E    ERRCODE_INVALID_XML_CONTENT                                    invalid_xml_content
+2200S    E    ERRCODE_INVALID_XML_COMMENT                                    invalid_xml_comment
+2200T    E    ERRCODE_INVALID_XML_PROCESSING_INSTRUCTION                     invalid_xml_processing_instruction
+
+Section: Class 23 - Integrity Constraint Violation
+
+23000    E    ERRCODE_INTEGRITY_CONSTRAINT_VIOLATION                         integrity_constraint_violation
+23001    E    ERRCODE_RESTRICT_VIOLATION                                     restrict_violation
+23502    E    ERRCODE_NOT_NULL_VIOLATION                                     not_null_violation
+23503    E    ERRCODE_FOREIGN_KEY_VIOLATION                                  foreign_key_violation
+23505    E    ERRCODE_UNIQUE_VIOLATION                                       unique_violation
+23514    E    ERRCODE_CHECK_VIOLATION                                        check_violation
+23P01    E    ERRCODE_EXCLUSION_VIOLATION                                    exclusion_violation
+
+Section: Class 24 - Invalid Cursor State
+
+24000    E    ERRCODE_INVALID_CURSOR_STATE                                   invalid_cursor_state
+
+Section: Class 25 - Invalid Transaction State
+
+25000    E    ERRCODE_INVALID_TRANSACTION_STATE                              invalid_transaction_state
+25001    E    ERRCODE_ACTIVE_SQL_TRANSACTION                                 active_sql_transaction
+25002    E    ERRCODE_BRANCH_TRANSACTION_ALREADY_ACTIVE                      branch_transaction_already_active
+25008    E    ERRCODE_HELD_CURSOR_REQUIRES_SAME_ISOLATION_LEVEL              held_cursor_requires_same_isolation_level
+25003    E    ERRCODE_INAPPROPRIATE_ACCESS_MODE_FOR_BRANCH_TRANSACTION       inappropriate_access_mode_for_branch_transaction
+25004    E    ERRCODE_INAPPROPRIATE_ISOLATION_LEVEL_FOR_BRANCH_TRANSACTION   inappropriate_isolation_level_for_branch_transaction
+25005    E    ERRCODE_NO_ACTIVE_SQL_TRANSACTION_FOR_BRANCH_TRANSACTION       no_active_sql_transaction_for_branch_transaction
+25006    E    ERRCODE_READ_ONLY_SQL_TRANSACTION                              read_only_sql_transaction
+25007    E    ERRCODE_SCHEMA_AND_DATA_STATEMENT_MIXING_NOT_SUPPORTED         schema_and_data_statement_mixing_not_supported
+25P01    E    ERRCODE_NO_ACTIVE_SQL_TRANSACTION                              no_active_sql_transaction
+25P02    E    ERRCODE_IN_FAILED_SQL_TRANSACTION                              in_failed_sql_transaction
+
+Section: Class 26 - Invalid SQL Statement Name
+
+# (we take this to mean prepared statements
+26000    E    ERRCODE_INVALID_SQL_STATEMENT_NAME                             invalid_sql_statement_name
+
+Section: Class 27 - Triggered Data Change Violation
+
+27000    E    ERRCODE_TRIGGERED_DATA_CHANGE_VIOLATION                        triggered_data_change_violation
+
+Section: Class 28 - Invalid Authorization Specification
+
+28000    E    ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION                    invalid_authorization_specification
+28P01    E    ERRCODE_INVALID_PASSWORD                                       invalid_password
+
+Section: Class 2B - Dependent Privilege Descriptors Still Exist
+
+2B000    E    ERRCODE_DEPENDENT_PRIVILEGE_DESCRIPTORS_STILL_EXIST            dependent_privilege_descriptors_still_exist
+2BP01    E    ERRCODE_DEPENDENT_OBJECTS_STILL_EXIST                          dependent_objects_still_exist
+
+Section: Class 2D - Invalid Transaction Termination
+
+2D000    E    ERRCODE_INVALID_TRANSACTION_TERMINATION                        invalid_transaction_termination
+
+Section: Class 2F - SQL Routine Exception
+
+2F000    E    ERRCODE_SQL_ROUTINE_EXCEPTION                                  sql_routine_exception
+2F005    E    ERRCODE_S_R_E_FUNCTION_EXECUTED_NO_RETURN_STATEMENT            function_executed_no_return_statement
+2F002    E    ERRCODE_S_R_E_MODIFYING_SQL_DATA_NOT_PERMITTED                 modifying_sql_data_not_permitted
+2F003    E    ERRCODE_S_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED               prohibited_sql_statement_attempted
+2F004    E    ERRCODE_S_R_E_READING_SQL_DATA_NOT_PERMITTED                   reading_sql_data_not_permitted
+
+Section: Class 34 - Invalid Cursor Name
+
+34000    E    ERRCODE_INVALID_CURSOR_NAME                                    invalid_cursor_name
+
+Section: Class 38 - External Routine Exception
+
+38000    E    ERRCODE_EXTERNAL_ROUTINE_EXCEPTION                             external_routine_exception
+38001    E    ERRCODE_E_R_E_CONTAINING_SQL_NOT_PERMITTED                     containing_sql_not_permitted
+38002    E    ERRCODE_E_R_E_MODIFYING_SQL_DATA_NOT_PERMITTED                 modifying_sql_data_not_permitted
+38003    E    ERRCODE_E_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED               prohibited_sql_statement_attempted
+38004    E    ERRCODE_E_R_E_READING_SQL_DATA_NOT_PERMITTED                   reading_sql_data_not_permitted
+
+Section: Class 39 - External Routine Invocation Exception
+
+39000    E    ERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION                  external_routine_invocation_exception
+39001    E    ERRCODE_E_R_I_E_INVALID_SQLSTATE_RETURNED                      invalid_sqlstate_returned
+39004    E    ERRCODE_E_R_I_E_NULL_VALUE_NOT_ALLOWED                         null_value_not_allowed
+39P01    E    ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED                      trigger_protocol_violated
+39P02    E    ERRCODE_E_R_I_E_SRF_PROTOCOL_VIOLATED                          srf_protocol_violated
+
+Section: Class 3B - Savepoint Exception
+
+3B000    E    ERRCODE_SAVEPOINT_EXCEPTION                                    savepoint_exception
+3B001    E    ERRCODE_S_E_INVALID_SPECIFICATION                              invalid_savepoint_specification
+
+Section: Class 3D - Invalid Catalog Name
+
+3D000    E    ERRCODE_INVALID_CATALOG_NAME                                   invalid_catalog_name
+
+Section: Class 3F - Invalid Schema Name
+
+3F000    E    ERRCODE_INVALID_SCHEMA_NAME                                    invalid_schema_name
+
+Section: Class 40 - Transaction Rollback
+
+40000    E    ERRCODE_TRANSACTION_ROLLBACK                                   transaction_rollback
+40002    E    ERRCODE_T_R_INTEGRITY_CONSTRAINT_VIOLATION                     transaction_integrity_constraint_violation
+40001    E    ERRCODE_T_R_SERIALIZATION_FAILURE                              serialization_failure
+40003    E    ERRCODE_T_R_STATEMENT_COMPLETION_UNKNOWN                       statement_completion_unknown
+40P01    E    ERRCODE_T_R_DEADLOCK_DETECTED                                  deadlock_detected
+
+Section: Class 42 - Syntax Error or Access Rule Violation
+
+42000    E    ERRCODE_SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION                  syntax_error_or_access_rule_violation
+# never use the above; use one of these two if no specific code exists:
+42601    E    ERRCODE_SYNTAX_ERROR                                           syntax_error
+42501    E    ERRCODE_INSUFFICIENT_PRIVILEGE                                 insufficient_privilege
+42846    E    ERRCODE_CANNOT_COERCE                                          cannot_coerce
+42803    E    ERRCODE_GROUPING_ERROR                                         grouping_error
+42P20    E    ERRCODE_WINDOWING_ERROR                                        windowing_error
+42P19    E    ERRCODE_INVALID_RECURSION                                      invalid_recursion
+42830    E    ERRCODE_INVALID_FOREIGN_KEY                                    invalid_foreign_key
+42602    E    ERRCODE_INVALID_NAME                                           invalid_name
+42622    E    ERRCODE_NAME_TOO_LONG                                          name_too_long
+42939    E    ERRCODE_RESERVED_NAME                                          reserved_name
+42804    E    ERRCODE_DATATYPE_MISMATCH                                      datatype_mismatch
+42P18    E    ERRCODE_INDETERMINATE_DATATYPE                                 indeterminate_datatype
+42809    E    ERRCODE_WRONG_OBJECT_TYPE                                      wrong_object_type
+
+# Note: for ERRCODE purposes, we divide namable objects into these categories:
+# databases, schemas, prepared statements, cursors, tables, columns,
+# functions (including operators), and all else (lumped as "objects").
+# (The first four categories are mandated by the existence of separate
+# SQLSTATE classes for them in the spec; in this file, however, we group
+# the ERRCODE names with all the rest under class 42.)  Parameters are
+# sort-of-named objects and get their own ERRCODE.
+#
+# The same breakdown is used for "duplicate" and "ambiguous" complaints,
+# as well as complaints associated with incorrect declarations.
+
+42703    E    ERRCODE_UNDEFINED_COLUMN                                       undefined_column
+34000    E    ERRCODE_UNDEFINED_CURSOR
+3D000    E    ERRCODE_UNDEFINED_DATABASE
+42883    E    ERRCODE_UNDEFINED_FUNCTION                                     undefined_function
+26000    E    ERRCODE_UNDEFINED_PSTATEMENT
+3F000    E    ERRCODE_UNDEFINED_SCHEMA
+42P01    E    ERRCODE_UNDEFINED_TABLE                                        undefined_table
+42P02    E    ERRCODE_UNDEFINED_PARAMETER                                    undefined_parameter
+42704    E    ERRCODE_UNDEFINED_OBJECT                                       undefined_object
+42701    E    ERRCODE_DUPLICATE_COLUMN                                       duplicate_column
+42P03    E    ERRCODE_DUPLICATE_CURSOR                                       duplicate_cursor
+42P04    E    ERRCODE_DUPLICATE_DATABASE                                     duplicate_database
+42723    E    ERRCODE_DUPLICATE_FUNCTION                                     duplicate_function
+42P05    E    ERRCODE_DUPLICATE_PSTATEMENT                                   duplicate_prepared_statement
+42P06    E    ERRCODE_DUPLICATE_SCHEMA                                       duplicate_schema
+42P07    E    ERRCODE_DUPLICATE_TABLE                                        duplicate_table
+42712    E    ERRCODE_DUPLICATE_ALIAS                                        duplicate_alias
+42710    E    ERRCODE_DUPLICATE_OBJECT                                       duplicate_object
+42702    E    ERRCODE_AMBIGUOUS_COLUMN                                       ambiguous_column
+42725    E    ERRCODE_AMBIGUOUS_FUNCTION                                     ambiguous_function
+42P08    E    ERRCODE_AMBIGUOUS_PARAMETER                                    ambiguous_parameter
+42P09    E    ERRCODE_AMBIGUOUS_ALIAS                                        ambiguous_alias
+42P10    E    ERRCODE_INVALID_COLUMN_REFERENCE                               invalid_column_reference
+42611    E    ERRCODE_INVALID_COLUMN_DEFINITION                              invalid_column_definition
+42P11    E    ERRCODE_INVALID_CURSOR_DEFINITION                              invalid_cursor_definition
+42P12    E    ERRCODE_INVALID_DATABASE_DEFINITION                            invalid_database_definition
+42P13    E    ERRCODE_INVALID_FUNCTION_DEFINITION                            invalid_function_definition
+42P14    E    ERRCODE_INVALID_PSTATEMENT_DEFINITION                          invalid_prepared_statement_definition
+42P15    E    ERRCODE_INVALID_SCHEMA_DEFINITION                              invalid_schema_definition
+42P16    E    ERRCODE_INVALID_TABLE_DEFINITION                               invalid_table_definition
+42P17    E    ERRCODE_INVALID_OBJECT_DEFINITION                              invalid_object_definition
+
+Section: Class 44 - WITH CHECK OPTION Violation
+
+44000    E    ERRCODE_WITH_CHECK_OPTION_VIOLATION                            with_check_option_violation
+
+Section: Class 53 - Insufficient Resources
+
+# (PostgreSQL-specific error class)
+53000    E    ERRCODE_INSUFFICIENT_RESOURCES                                 insufficient_resources
+53100    E    ERRCODE_DISK_FULL                                              disk_full
+53200    E    ERRCODE_OUT_OF_MEMORY                                          out_of_memory
+53300    E    ERRCODE_TOO_MANY_CONNECTIONS                                   too_many_connections
+
+Section: Class 54 - Program Limit Exceeded
+
+# this is for wired-in limits, not resource exhaustion problems (class borrowed from DB2)
+54000    E    ERRCODE_PROGRAM_LIMIT_EXCEEDED                                 program_limit_exceeded
+54001    E    ERRCODE_STATEMENT_TOO_COMPLEX                                  statement_too_complex
+54011    E    ERRCODE_TOO_MANY_COLUMNS                                       too_many_columns
+54023    E    ERRCODE_TOO_MANY_ARGUMENTS                                     too_many_arguments
+
+Section: Class 55 - Object Not In Prerequisite State
+
+# (class borrowed from DB2)
+55000    E    ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE                       object_not_in_prerequisite_state
+55006    E    ERRCODE_OBJECT_IN_USE                                          object_in_use
+55P02    E    ERRCODE_CANT_CHANGE_RUNTIME_PARAM                              cant_change_runtime_param
+55P03    E    ERRCODE_LOCK_NOT_AVAILABLE                                     lock_not_available
+
+Section: Class 57 - Operator Intervention
+
+# (class borrowed from DB2)
+57000    E    ERRCODE_OPERATOR_INTERVENTION                                  operator_intervention
+57014    E    ERRCODE_QUERY_CANCELED                                         query_canceled
+57P01    E    ERRCODE_ADMIN_SHUTDOWN                                         admin_shutdown
+57P02    E    ERRCODE_CRASH_SHUTDOWN                                         crash_shutdown
+57P03    E    ERRCODE_CANNOT_CONNECT_NOW                                     cannot_connect_now
+57P04    E    ERRCODE_DATABASE_DROPPED                                                                          database_dropped
+
+Section: Class 58 - System Error (errors external to PostgreSQL itself)
+
+# (class borrowed from DB2)
+58030    E    ERRCODE_IO_ERROR                                               io_error
+58P01    E    ERRCODE_UNDEFINED_FILE                                         undefined_file
+58P02    E    ERRCODE_DUPLICATE_FILE                                         duplicate_file
+
+Section: Class F0 - Configuration File Error
+
+# (PostgreSQL-specific error class)
+F0000    E    ERRCODE_CONFIG_FILE_ERROR                                      config_file_error
+F0001    E    ERRCODE_LOCK_FILE_EXISTS                                       lock_file_exists
+
+Section: Class HV - Foreign Data Wrapper Error (SQL/MED)
+
+# (SQL/MED-specific error class)
+HV000    E    ERRCODE_FDW_ERROR                                              fdw_error
+HV005    E    ERRCODE_FDW_COLUMN_NAME_NOT_FOUND                              fdw_column_name_not_found
+HV002    E    ERRCODE_FDW_DYNAMIC_PARAMETER_VALUE_NEEDED                     fdw_dynamic_parameter_value_needed
+HV010    E    ERRCODE_FDW_FUNCTION_SEQUENCE_ERROR                                   fdw_function_sequence_error
+HV021    E    ERRCODE_FDW_INCONSISTENT_DESCRIPTOR_INFORMATION                fdw_inconsistent_descriptor_information
+HV024    E    ERRCODE_FDW_INVALID_ATTRIBUTE_VALUE                           fdw_invalid_attribute_value
+HV007    E    ERRCODE_FDW_INVALID_COLUMN_NAME                               fdw_invalid_column_name
+HV008    E    ERRCODE_FDW_INVALID_COLUMN_NUMBER                                     fdw_invalid_column_number
+HV004    E    ERRCODE_FDW_INVALID_DATA_TYPE                                 fdw_invalid_data_type
+HV006    E    ERRCODE_FDW_INVALID_DATA_TYPE_DESCRIPTORS                             fdw_invalid_data_type_descriptors
+HV091    E    ERRCODE_FDW_INVALID_DESCRIPTOR_FIELD_IDENTIFIER               fdw_invalid_descriptor_field_identifier
+HV00B    E    ERRCODE_FDW_INVALID_HANDLE                                    fdw_invalid_handle
+HV00C    E    ERRCODE_FDW_INVALID_OPTION_INDEX                              fdw_invalid_option_index
+HV00D    E    ERRCODE_FDW_INVALID_OPTION_NAME                               fdw_invalid_option_name
+HV090    E    ERRCODE_FDW_INVALID_STRING_LENGTH_OR_BUFFER_LENGTH            fdw_invalid_string_length_or_buffer_length
+HV00A    E    ERRCODE_FDW_INVALID_STRING_FORMAT                                     fdw_invalid_string_format
+HV009    E    ERRCODE_FDW_INVALID_USE_OF_NULL_POINTER                       fdw_invalid_use_of_null_pointer
+HV014    E    ERRCODE_FDW_TOO_MANY_HANDLES                                  fdw_too_many_handles
+HV001    E    ERRCODE_FDW_OUT_OF_MEMORY                                             fdw_out_of_memory
+HV00P    E    ERRCODE_FDW_NO_SCHEMAS                                        fdw_no_schemas
+HV00J    E    ERRCODE_FDW_OPTION_NAME_NOT_FOUND                                     fdw_option_name_not_found
+HV00K    E    ERRCODE_FDW_REPLY_HANDLE                                      fdw_reply_handle
+HV00Q    E    ERRCODE_FDW_SCHEMA_NOT_FOUND                                  fdw_schema_not_found
+HV00R    E    ERRCODE_FDW_TABLE_NOT_FOUND                                   fdw_table_not_found
+HV00L    E    ERRCODE_FDW_UNABLE_TO_CREATE_EXECUTION                        fdw_unable_to_create_execution
+HV00M    E    ERRCODE_FDW_UNABLE_TO_CREATE_REPLY                            fdw_unable_to_create_reply
+HV00N    E    ERRCODE_FDW_UNABLE_TO_ESTABLISH_CONNECTION                    fdw_unable_to_establish_connection
+
+Section: Class P0 - PL/pgSQL Error
+
+# (PostgreSQL-specific error class)
+P0000    E    ERRCODE_PLPGSQL_ERROR                                          plpgsql_error
+P0001    E    ERRCODE_RAISE_EXCEPTION                                        raise_exception
+P0002    E    ERRCODE_NO_DATA_FOUND                                          no_data_found
+P0003    E    ERRCODE_TOO_MANY_ROWS                                          too_many_rows
+
+Section: Class XX - Internal Error
+
+# this is for "can't-happen" conditions and software bugs (PostgreSQL-specific error class)
+XX000    E    ERRCODE_INTERNAL_ERROR                                         internal_error
+XX001    E    ERRCODE_DATA_CORRUPTED                                         data_corrupted
+XX002    E    ERRCODE_INDEX_CORRUPTED                                        index_corrupted
diff --git a/src/backend/utils/generate-errcodes.pl b/src/backend/utils/generate-errcodes.pl
new file mode 100644 (file)
index 0000000..c7593aa
--- /dev/null
@@ -0,0 +1,41 @@
+#!/usr/bin/perl
+#
+# Generate the errcodes.h header from errcodes.txt
+# Copyright (c) 2000-2011, PostgreSQL Global Development Group
+
+use warnings;
+use strict;
+
+print "/* autogenerated from src/backend/utils/errcodes.txt, do not edit */\n";
+print "/* there is deliberately not an #ifndef ERRCODES_H here */\n";
+
+open my $errcodes, $ARGV[0] or die;
+
+while (<$errcodes>) {
+    chomp;
+
+    # Skip comments
+    next if /^#/;
+    next if /^\s*$/;
+
+    # Emit a comment for each section header
+    if (/^Section:(.*)/) {
+               my $header = $1;
+               $header =~ s/^\s+//;
+               print "\n/* $header */\n";
+               next;
+       }
+
+    die "unable to parse errcodes.txt" unless /^([^\s]{5})\s+[EWS]\s+([^\s]+)/;
+
+    (my $sqlstate, my $errcode_macro) = ($1, $2);
+
+    # Split the sqlstate letters
+    $sqlstate = join ",", split "", $sqlstate;
+    # And quote them
+    $sqlstate =~ s/([^,])/'$1'/g;
+
+    print "#define $errcode_macro MAKE_SQLSTATE($sqlstate)\n";
+}
+
+close $errcodes;
index b6744f6b904f64c0052a141791457590f52a6363..3701ad05411d1bfaa8aabc2fa56653f32f8ac99c 100644 (file)
@@ -62,7 +62,7 @@ uninstall:
 
 
 clean:
-       rm -f utils/fmgroids.h parser/gram.h utils/probes.h catalog/schemapg.h
+       rm -f utils/fmgroids.h utils/errcodes.h parser/gram.h utils/probes.h catalog/schemapg.h
 
 distclean maintainer-clean: clean
        rm -f pg_config.h dynloader.h pg_config_os.h stamp-h
index c7c402b3dc8ec4fac93a419fbdcaddc6ae38aabf..808826d1478ba539d98c5978267ee8dd529a09dd 100644 (file)
@@ -1,2 +1,3 @@
 /fmgroids.h
 /probes.h
+/errcodes.h
diff --git a/src/include/utils/errcodes.h b/src/include/utils/errcodes.h
deleted file mode 100644 (file)
index 2bcaf03..0000000
+++ /dev/null
@@ -1,386 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * errcodes.h
- *       POSTGRES error codes
- *
- * The error code list is kept in its own source file for possible use by
- * automatic tools.  Each error code is identified by a five-character string
- * following the SQLSTATE conventions. The exact representation of the
- * string is determined by the MAKE_SQLSTATE() macro, which is not defined
- * in this file; it can be defined by the caller for special purposes.
- *
- * Copyright (c) 2003-2011, PostgreSQL Global Development Group
- *
- * src/include/utils/errcodes.h
- *
- *-------------------------------------------------------------------------
- */
-
-/* there is deliberately not an #ifndef ERRCODES_H here */
-
-
-/*
- * SQLSTATE codes for errors.
- *
- * The SQL99 code set is rather impoverished, especially in the area of
- * syntactical and semantic errors.  We have borrowed codes from IBM's DB2
- * and invented our own codes to develop a useful code set.
- *
- * When adding a new code, make sure it is placed in the most appropriate
- * class (the first two characters of the code value identify the class).
- * The listing is organized by class to make this prominent.
- *
- * The generic '000' subclass code should be used for an error only
- * when there is not a more-specific subclass code defined.
- *
- * The SQL spec requires that all the elements of a SQLSTATE code be
- * either digits or upper-case ASCII characters.
- *
- * Classes that begin with 0-4 or A-H are defined by the
- * standard. Within such a class, subclass values defined by the
- * standard must begin with 0-4 or A-H. To define a new error code,
- * ensure that it is either in an "implementation-defined class" (it
- * begins with 5-9 or I-Z), or its subclass falls outside the range of
- * error codes that could be present in future versions of the
- * standard (i.e. the subclass value begins with 5-9 or I-Z).
- *
- * The convention is that new error codes defined by PostgreSQL in a
- * class defined by the standard have a subclass value that begins
- * with 'P'. In addition, error codes defined by PostgreSQL clients
- * (such as ecpg) have a class value that begins with 'Y'.
- */
-
-/* Class 00 - Successful Completion */
-#define ERRCODE_SUCCESSFUL_COMPLETION          MAKE_SQLSTATE('0','0', '0','0','0')
-
-/* Class 01 - Warning */
-/* (do not use this class for failure conditions!) */
-#define ERRCODE_WARNING                                                MAKE_SQLSTATE('0','1', '0','0','0')
-#define ERRCODE_WARNING_DYNAMIC_RESULT_SETS_RETURNED           MAKE_SQLSTATE('0','1', '0','0','C')
-#define ERRCODE_WARNING_IMPLICIT_ZERO_BIT_PADDING      MAKE_SQLSTATE('0','1', '0','0','8')
-#define ERRCODE_WARNING_NULL_VALUE_ELIMINATED_IN_SET_FUNCTION  MAKE_SQLSTATE('0','1', '0','0','3')
-#define ERRCODE_WARNING_PRIVILEGE_NOT_GRANTED          MAKE_SQLSTATE('0','1', '0','0','7')
-#define ERRCODE_WARNING_PRIVILEGE_NOT_REVOKED          MAKE_SQLSTATE('0','1', '0','0','6')
-#define ERRCODE_WARNING_STRING_DATA_RIGHT_TRUNCATION   MAKE_SQLSTATE('0','1', '0','0','4')
-#define ERRCODE_WARNING_DEPRECATED_FEATURE     MAKE_SQLSTATE('0','1', 'P','0','1')
-
-/* Class 02 - No Data --- this is also a warning class per SQL99 */
-/* (do not use this class for failure conditions!) */
-#define ERRCODE_NO_DATA                                                MAKE_SQLSTATE('0','2', '0','0','0')
-#define ERRCODE_NO_ADDITIONAL_DYNAMIC_RESULT_SETS_RETURNED     MAKE_SQLSTATE('0','2', '0','0','1')
-
-/* Class 03 - SQL Statement Not Yet Complete */
-#define ERRCODE_SQL_STATEMENT_NOT_YET_COMPLETE         MAKE_SQLSTATE('0','3', '0','0','0')
-
-/* Class 08 - Connection Exception */
-#define ERRCODE_CONNECTION_EXCEPTION           MAKE_SQLSTATE('0','8', '0','0','0')
-#define ERRCODE_CONNECTION_DOES_NOT_EXIST      MAKE_SQLSTATE('0','8', '0','0','3')
-#define ERRCODE_CONNECTION_FAILURE                     MAKE_SQLSTATE('0','8', '0','0','6')
-#define ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION            MAKE_SQLSTATE('0','8', '0','0','1')
-#define ERRCODE_SQLSERVER_REJECTED_ESTABLISHMENT_OF_SQLCONNECTION      MAKE_SQLSTATE('0','8', '0','0','4')
-#define ERRCODE_TRANSACTION_RESOLUTION_UNKNOWN         MAKE_SQLSTATE('0','8', '0','0','7')
-#define ERRCODE_PROTOCOL_VIOLATION                     MAKE_SQLSTATE('0','8', 'P','0','1')
-
-/* Class 09 - Triggered Action Exception */
-#define ERRCODE_TRIGGERED_ACTION_EXCEPTION     MAKE_SQLSTATE('0','9', '0','0','0')
-
-/* Class 0A - Feature Not Supported */
-#define ERRCODE_FEATURE_NOT_SUPPORTED          MAKE_SQLSTATE('0','A', '0','0','0')
-
-/* Class 0B - Invalid Transaction Initiation */
-#define ERRCODE_INVALID_TRANSACTION_INITIATION         MAKE_SQLSTATE('0','B', '0','0','0')
-
-/* Class 0F - Locator Exception */
-#define ERRCODE_LOCATOR_EXCEPTION                      MAKE_SQLSTATE('0','F', '0','0','0')
-#define ERRCODE_L_E_INVALID_SPECIFICATION      MAKE_SQLSTATE('0','F', '0','0','1')
-
-/* Class 0L - Invalid Grantor */
-#define ERRCODE_INVALID_GRANTOR                                MAKE_SQLSTATE('0','L', '0','0','0')
-#define ERRCODE_INVALID_GRANT_OPERATION                MAKE_SQLSTATE('0','L', 'P','0','1')
-
-/* Class 0P - Invalid Role Specification */
-#define ERRCODE_INVALID_ROLE_SPECIFICATION     MAKE_SQLSTATE('0','P', '0','0','0')
-
-/* Class 20 - Case Not Found */
-#define ERRCODE_CASE_NOT_FOUND                         MAKE_SQLSTATE('2','0', '0','0','0')
-
-/* Class 21 - Cardinality Violation */
-/* (this means something returned the wrong number of rows) */
-#define ERRCODE_CARDINALITY_VIOLATION          MAKE_SQLSTATE('2','1', '0','0','0')
-
-/* Class 22 - Data Exception */
-#define ERRCODE_DATA_EXCEPTION                         MAKE_SQLSTATE('2','2', '0','0','0')
-#define ERRCODE_ARRAY_ELEMENT_ERROR                    MAKE_SQLSTATE('2','2', '0','2','E')
-/* SQL99's actual definition of "array element error" is subscript error */
-#define ERRCODE_ARRAY_SUBSCRIPT_ERROR          ERRCODE_ARRAY_ELEMENT_ERROR
-#define ERRCODE_CHARACTER_NOT_IN_REPERTOIRE MAKE_SQLSTATE('2','2', '0','2','1')
-#define ERRCODE_DATETIME_FIELD_OVERFLOW                MAKE_SQLSTATE('2','2', '0','0','8')
-#define ERRCODE_DATETIME_VALUE_OUT_OF_RANGE ERRCODE_DATETIME_FIELD_OVERFLOW
-#define ERRCODE_DIVISION_BY_ZERO                       MAKE_SQLSTATE('2','2', '0','1','2')
-#define ERRCODE_ERROR_IN_ASSIGNMENT                    MAKE_SQLSTATE('2','2', '0','0','5')
-#define ERRCODE_ESCAPE_CHARACTER_CONFLICT      MAKE_SQLSTATE('2','2', '0','0','B')
-#define ERRCODE_INDICATOR_OVERFLOW                     MAKE_SQLSTATE('2','2', '0','2','2')
-#define ERRCODE_INTERVAL_FIELD_OVERFLOW                MAKE_SQLSTATE('2','2', '0','1','5')
-#define ERRCODE_INVALID_ARGUMENT_FOR_LOG       MAKE_SQLSTATE('2','2', '0','1','E')
-#define ERRCODE_INVALID_ARGUMENT_FOR_NTILE     MAKE_SQLSTATE('2','2', '0','1','4')
-#define ERRCODE_INVALID_ARGUMENT_FOR_NTH_VALUE MAKE_SQLSTATE('2','2', '0','1','6')
-#define ERRCODE_INVALID_ARGUMENT_FOR_POWER_FUNCTION MAKE_SQLSTATE('2','2', '0', '1', 'F')
-#define ERRCODE_INVALID_ARGUMENT_FOR_WIDTH_BUCKET_FUNCTION     MAKE_SQLSTATE('2','2', '0', '1', 'G')
-#define ERRCODE_INVALID_CHARACTER_VALUE_FOR_CAST               MAKE_SQLSTATE('2','2', '0','1','8')
-#define ERRCODE_INVALID_DATETIME_FORMAT                MAKE_SQLSTATE('2','2', '0','0','7')
-#define ERRCODE_INVALID_ESCAPE_CHARACTER       MAKE_SQLSTATE('2','2', '0','1','9')
-#define ERRCODE_INVALID_ESCAPE_OCTET           MAKE_SQLSTATE('2','2', '0','0','D')
-#define ERRCODE_INVALID_ESCAPE_SEQUENCE                MAKE_SQLSTATE('2','2', '0','2','5')
-#define ERRCODE_NONSTANDARD_USE_OF_ESCAPE_CHARACTER            MAKE_SQLSTATE('2','2', 'P','0','6')
-#define ERRCODE_INVALID_INDICATOR_PARAMETER_VALUE              MAKE_SQLSTATE('2','2', '0','1','0')
-#define ERRCODE_INVALID_PARAMETER_VALUE                MAKE_SQLSTATE('2','2', '0','2','3')
-#define ERRCODE_INVALID_REGULAR_EXPRESSION     MAKE_SQLSTATE('2','2', '0','1','B')
-#define ERRCODE_INVALID_ROW_COUNT_IN_LIMIT_CLAUSE      MAKE_SQLSTATE('2', '2', '0', '1', 'W')
-#define ERRCODE_INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE      MAKE_SQLSTATE('2', '2', '0', '1', 'X')
-#define ERRCODE_INVALID_TIME_ZONE_DISPLACEMENT_VALUE   MAKE_SQLSTATE('2','2', '0','0','9')
-#define ERRCODE_INVALID_USE_OF_ESCAPE_CHARACTER                MAKE_SQLSTATE('2','2', '0','0','C')
-#define ERRCODE_MOST_SPECIFIC_TYPE_MISMATCH MAKE_SQLSTATE('2','2', '0','0','G')
-#define ERRCODE_NULL_VALUE_NOT_ALLOWED         MAKE_SQLSTATE('2','2', '0','0','4')
-#define ERRCODE_NULL_VALUE_NO_INDICATOR_PARAMETER      MAKE_SQLSTATE('2','2', '0','0','2')
-#define ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE     MAKE_SQLSTATE('2','2', '0','0','3')
-#define ERRCODE_STRING_DATA_LENGTH_MISMATCH MAKE_SQLSTATE('2','2', '0','2','6')
-#define ERRCODE_STRING_DATA_RIGHT_TRUNCATION           MAKE_SQLSTATE('2','2', '0','0','1')
-#define ERRCODE_SUBSTRING_ERROR                                MAKE_SQLSTATE('2','2', '0','1','1')
-#define ERRCODE_TRIM_ERROR                                     MAKE_SQLSTATE('2','2', '0','2','7')
-#define ERRCODE_UNTERMINATED_C_STRING          MAKE_SQLSTATE('2','2', '0','2','4')
-#define ERRCODE_ZERO_LENGTH_CHARACTER_STRING           MAKE_SQLSTATE('2','2', '0','0','F')
-#define ERRCODE_FLOATING_POINT_EXCEPTION       MAKE_SQLSTATE('2','2', 'P','0','1')
-#define ERRCODE_INVALID_TEXT_REPRESENTATION MAKE_SQLSTATE('2','2', 'P','0','2')
-#define ERRCODE_INVALID_BINARY_REPRESENTATION  MAKE_SQLSTATE('2','2', 'P','0','3')
-#define ERRCODE_BAD_COPY_FILE_FORMAT           MAKE_SQLSTATE('2','2', 'P','0','4')
-#define ERRCODE_UNTRANSLATABLE_CHARACTER       MAKE_SQLSTATE('2','2', 'P','0','5')
-#define ERRCODE_NOT_AN_XML_DOCUMENT                    MAKE_SQLSTATE('2', '2', '0', '0', 'L')
-#define ERRCODE_INVALID_XML_DOCUMENT                   MAKE_SQLSTATE('2', '2', '0', '0', 'M')
-#define ERRCODE_INVALID_XML_CONTENT                    MAKE_SQLSTATE('2', '2', '0', '0', 'N')
-#define ERRCODE_INVALID_XML_COMMENT                    MAKE_SQLSTATE('2', '2', '0', '0', 'S')
-#define ERRCODE_INVALID_XML_PROCESSING_INSTRUCTION     MAKE_SQLSTATE('2', '2', '0', '0', 'T')
-
-/* Class 23 - Integrity Constraint Violation */
-#define ERRCODE_INTEGRITY_CONSTRAINT_VIOLATION         MAKE_SQLSTATE('2','3', '0','0','0')
-#define ERRCODE_RESTRICT_VIOLATION                     MAKE_SQLSTATE('2','3', '0','0','1')
-#define ERRCODE_NOT_NULL_VIOLATION                     MAKE_SQLSTATE('2','3', '5','0','2')
-#define ERRCODE_FOREIGN_KEY_VIOLATION          MAKE_SQLSTATE('2','3', '5','0','3')
-#define ERRCODE_UNIQUE_VIOLATION                       MAKE_SQLSTATE('2','3', '5','0','5')
-#define ERRCODE_CHECK_VIOLATION                                MAKE_SQLSTATE('2','3', '5','1','4')
-#define ERRCODE_EXCLUSION_VIOLATION                    MAKE_SQLSTATE('2','3', 'P','0','1')
-
-/* Class 24 - Invalid Cursor State */
-#define ERRCODE_INVALID_CURSOR_STATE           MAKE_SQLSTATE('2','4', '0','0','0')
-
-/* Class 25 - Invalid Transaction State */
-#define ERRCODE_INVALID_TRANSACTION_STATE      MAKE_SQLSTATE('2','5', '0','0','0')
-#define ERRCODE_ACTIVE_SQL_TRANSACTION         MAKE_SQLSTATE('2','5', '0','0','1')
-#define ERRCODE_BRANCH_TRANSACTION_ALREADY_ACTIVE      MAKE_SQLSTATE('2','5', '0','0','2')
-#define ERRCODE_HELD_CURSOR_REQUIRES_SAME_ISOLATION_LEVEL      MAKE_SQLSTATE('2','5', '0','0','8')
-#define ERRCODE_INAPPROPRIATE_ACCESS_MODE_FOR_BRANCH_TRANSACTION       MAKE_SQLSTATE('2','5', '0','0','3')
-#define ERRCODE_INAPPROPRIATE_ISOLATION_LEVEL_FOR_BRANCH_TRANSACTION   MAKE_SQLSTATE('2','5', '0','0','4')
-#define ERRCODE_NO_ACTIVE_SQL_TRANSACTION_FOR_BRANCH_TRANSACTION       MAKE_SQLSTATE('2','5', '0','0','5')
-#define ERRCODE_READ_ONLY_SQL_TRANSACTION      MAKE_SQLSTATE('2','5', '0','0','6')
-#define ERRCODE_SCHEMA_AND_DATA_STATEMENT_MIXING_NOT_SUPPORTED MAKE_SQLSTATE('2','5', '0','0','7')
-#define ERRCODE_NO_ACTIVE_SQL_TRANSACTION      MAKE_SQLSTATE('2','5', 'P','0','1')
-#define ERRCODE_IN_FAILED_SQL_TRANSACTION      MAKE_SQLSTATE('2','5', 'P','0','2')
-
-/* Class 26 - Invalid SQL Statement Name */
-/* (we take this to mean prepared statements) */
-#define ERRCODE_INVALID_SQL_STATEMENT_NAME     MAKE_SQLSTATE('2','6', '0','0','0')
-
-/* Class 27 - Triggered Data Change Violation */
-#define ERRCODE_TRIGGERED_DATA_CHANGE_VIOLATION                MAKE_SQLSTATE('2','7', '0','0','0')
-
-/* Class 28 - Invalid Authorization Specification */
-#define ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION MAKE_SQLSTATE('2','8', '0','0','0')
-#define ERRCODE_INVALID_PASSWORD MAKE_SQLSTATE('2','8', 'P','0','1')
-
-/* Class 2B - Dependent Privilege Descriptors Still Exist */
-#define ERRCODE_DEPENDENT_PRIVILEGE_DESCRIPTORS_STILL_EXIST            MAKE_SQLSTATE('2','B', '0','0','0')
-#define ERRCODE_DEPENDENT_OBJECTS_STILL_EXIST          MAKE_SQLSTATE('2','B', 'P','0','1')
-
-/* Class 2D - Invalid Transaction Termination */
-#define ERRCODE_INVALID_TRANSACTION_TERMINATION                MAKE_SQLSTATE('2','D', '0','0','0')
-
-/* Class 2F - SQL Routine Exception */
-#define ERRCODE_SQL_ROUTINE_EXCEPTION          MAKE_SQLSTATE('2','F', '0','0','0')
-#define ERRCODE_S_R_E_FUNCTION_EXECUTED_NO_RETURN_STATEMENT MAKE_SQLSTATE('2','F', '0','0','5')
-#define ERRCODE_S_R_E_MODIFYING_SQL_DATA_NOT_PERMITTED         MAKE_SQLSTATE('2','F', '0','0','2')
-#define ERRCODE_S_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED       MAKE_SQLSTATE('2','F', '0','0','3')
-#define ERRCODE_S_R_E_READING_SQL_DATA_NOT_PERMITTED           MAKE_SQLSTATE('2','F', '0','0','4')
-
-/* Class 34 - Invalid Cursor Name */
-#define ERRCODE_INVALID_CURSOR_NAME                    MAKE_SQLSTATE('3','4', '0','0','0')
-
-/* Class 38 - External Routine Exception */
-#define ERRCODE_EXTERNAL_ROUTINE_EXCEPTION     MAKE_SQLSTATE('3','8', '0','0','0')
-#define ERRCODE_E_R_E_CONTAINING_SQL_NOT_PERMITTED     MAKE_SQLSTATE('3','8', '0','0','1')
-#define ERRCODE_E_R_E_MODIFYING_SQL_DATA_NOT_PERMITTED MAKE_SQLSTATE('3','8', '0','0','2')
-#define ERRCODE_E_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED       MAKE_SQLSTATE('3','8', '0','0','3')
-#define ERRCODE_E_R_E_READING_SQL_DATA_NOT_PERMITTED   MAKE_SQLSTATE('3','8', '0','0','4')
-
-/* Class 39 - External Routine Invocation Exception */
-#define ERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION  MAKE_SQLSTATE('3','9', '0','0','0')
-#define ERRCODE_E_R_I_E_INVALID_SQLSTATE_RETURNED      MAKE_SQLSTATE('3','9', '0','0','1')
-#define ERRCODE_E_R_I_E_NULL_VALUE_NOT_ALLOWED MAKE_SQLSTATE('3','9', '0','0','4')
-#define ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED      MAKE_SQLSTATE('3','9', 'P','0','1')
-#define ERRCODE_E_R_I_E_SRF_PROTOCOL_VIOLATED  MAKE_SQLSTATE('3','9', 'P','0','2')
-
-/* Class 3B - Savepoint Exception */
-#define ERRCODE_SAVEPOINT_EXCEPTION                    MAKE_SQLSTATE('3','B', '0','0','0')
-#define ERRCODE_S_E_INVALID_SPECIFICATION      MAKE_SQLSTATE('3','B', '0','0','1')
-
-/* Class 3D - Invalid Catalog Name */
-#define ERRCODE_INVALID_CATALOG_NAME           MAKE_SQLSTATE('3','D', '0','0','0')
-
-/* Class 3F - Invalid Schema Name */
-#define ERRCODE_INVALID_SCHEMA_NAME                    MAKE_SQLSTATE('3','F', '0','0','0')
-
-/* Class 40 - Transaction Rollback */
-#define ERRCODE_TRANSACTION_ROLLBACK           MAKE_SQLSTATE('4','0', '0','0','0')
-#define ERRCODE_T_R_INTEGRITY_CONSTRAINT_VIOLATION     MAKE_SQLSTATE('4','0', '0','0','2')
-#define ERRCODE_T_R_SERIALIZATION_FAILURE      MAKE_SQLSTATE('4','0', '0','0','1')
-#define ERRCODE_T_R_STATEMENT_COMPLETION_UNKNOWN       MAKE_SQLSTATE('4','0', '0','0','3')
-#define ERRCODE_T_R_DEADLOCK_DETECTED          MAKE_SQLSTATE('4','0', 'P','0','1')
-
-/* Class 42 - Syntax Error or Access Rule Violation */
-#define ERRCODE_SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION          MAKE_SQLSTATE('4','2', '0','0','0')
-/* never use the above; use one of these two if no specific code exists: */
-#define ERRCODE_SYNTAX_ERROR                           MAKE_SQLSTATE('4','2', '6','0','1')
-#define ERRCODE_INSUFFICIENT_PRIVILEGE         MAKE_SQLSTATE('4','2', '5','0','1')
-#define ERRCODE_CANNOT_COERCE                          MAKE_SQLSTATE('4','2', '8','4','6')
-#define ERRCODE_GROUPING_ERROR                         MAKE_SQLSTATE('4','2', '8','0','3')
-#define ERRCODE_WINDOWING_ERROR                                MAKE_SQLSTATE('4','2', 'P','2','0')
-#define ERRCODE_INVALID_RECURSION                      MAKE_SQLSTATE('4','2', 'P','1','9')
-#define ERRCODE_INVALID_FOREIGN_KEY                    MAKE_SQLSTATE('4','2', '8','3','0')
-#define ERRCODE_INVALID_NAME                           MAKE_SQLSTATE('4','2', '6','0','2')
-#define ERRCODE_NAME_TOO_LONG                          MAKE_SQLSTATE('4','2', '6','2','2')
-#define ERRCODE_RESERVED_NAME                          MAKE_SQLSTATE('4','2', '9','3','9')
-#define ERRCODE_DATATYPE_MISMATCH                      MAKE_SQLSTATE('4','2', '8','0','4')
-#define ERRCODE_INDETERMINATE_DATATYPE         MAKE_SQLSTATE('4','2', 'P','1','8')
-#define ERRCODE_WRONG_OBJECT_TYPE                      MAKE_SQLSTATE('4','2', '8','0','9')
-/*
- * Note: for ERRCODE purposes, we divide namable objects into these categories:
- * databases, schemas, prepared statements, cursors, tables, columns,
- * functions (including operators), and all else (lumped as "objects").
- * (The first four categories are mandated by the existence of separate
- * SQLSTATE classes for them in the spec; in this file, however, we group
- * the ERRCODE names with all the rest under class 42.)  Parameters are
- * sort-of-named objects and get their own ERRCODE.
- *
- * The same breakdown is used for "duplicate" and "ambiguous" complaints,
- * as well as complaints associated with incorrect declarations.
- */
-#define ERRCODE_UNDEFINED_COLUMN                       MAKE_SQLSTATE('4','2', '7','0','3')
-#define ERRCODE_UNDEFINED_CURSOR                       ERRCODE_INVALID_CURSOR_NAME
-#define ERRCODE_UNDEFINED_DATABASE                     ERRCODE_INVALID_CATALOG_NAME
-#define ERRCODE_UNDEFINED_FUNCTION                     MAKE_SQLSTATE('4','2', '8','8','3')
-#define ERRCODE_UNDEFINED_PSTATEMENT           ERRCODE_INVALID_SQL_STATEMENT_NAME
-#define ERRCODE_UNDEFINED_SCHEMA                       ERRCODE_INVALID_SCHEMA_NAME
-#define ERRCODE_UNDEFINED_TABLE                                MAKE_SQLSTATE('4','2', 'P','0','1')
-#define ERRCODE_UNDEFINED_PARAMETER                    MAKE_SQLSTATE('4','2', 'P','0','2')
-#define ERRCODE_UNDEFINED_OBJECT                       MAKE_SQLSTATE('4','2', '7','0','4')
-#define ERRCODE_DUPLICATE_COLUMN                       MAKE_SQLSTATE('4','2', '7','0','1')
-#define ERRCODE_DUPLICATE_CURSOR                       MAKE_SQLSTATE('4','2', 'P','0','3')
-#define ERRCODE_DUPLICATE_DATABASE                     MAKE_SQLSTATE('4','2', 'P','0','4')
-#define ERRCODE_DUPLICATE_FUNCTION                     MAKE_SQLSTATE('4','2', '7','2','3')
-#define ERRCODE_DUPLICATE_PSTATEMENT           MAKE_SQLSTATE('4','2', 'P','0','5')
-#define ERRCODE_DUPLICATE_SCHEMA                       MAKE_SQLSTATE('4','2', 'P','0','6')
-#define ERRCODE_DUPLICATE_TABLE                                MAKE_SQLSTATE('4','2', 'P','0','7')
-#define ERRCODE_DUPLICATE_ALIAS                                MAKE_SQLSTATE('4','2', '7','1','2')
-#define ERRCODE_DUPLICATE_OBJECT                       MAKE_SQLSTATE('4','2', '7','1','0')
-#define ERRCODE_AMBIGUOUS_COLUMN                       MAKE_SQLSTATE('4','2', '7','0','2')
-#define ERRCODE_AMBIGUOUS_FUNCTION                     MAKE_SQLSTATE('4','2', '7','2','5')
-#define ERRCODE_AMBIGUOUS_PARAMETER                    MAKE_SQLSTATE('4','2', 'P','0','8')
-#define ERRCODE_AMBIGUOUS_ALIAS                                MAKE_SQLSTATE('4','2', 'P','0','9')
-#define ERRCODE_INVALID_COLUMN_REFERENCE       MAKE_SQLSTATE('4','2', 'P','1','0')
-#define ERRCODE_INVALID_COLUMN_DEFINITION      MAKE_SQLSTATE('4','2', '6','1','1')
-#define ERRCODE_INVALID_CURSOR_DEFINITION      MAKE_SQLSTATE('4','2', 'P','1','1')
-#define ERRCODE_INVALID_DATABASE_DEFINITION MAKE_SQLSTATE('4','2', 'P','1','2')
-#define ERRCODE_INVALID_FUNCTION_DEFINITION MAKE_SQLSTATE('4','2', 'P','1','3')
-#define ERRCODE_INVALID_PSTATEMENT_DEFINITION  MAKE_SQLSTATE('4','2', 'P','1','4')
-#define ERRCODE_INVALID_SCHEMA_DEFINITION      MAKE_SQLSTATE('4','2', 'P','1','5')
-#define ERRCODE_INVALID_TABLE_DEFINITION       MAKE_SQLSTATE('4','2', 'P','1','6')
-#define ERRCODE_INVALID_OBJECT_DEFINITION      MAKE_SQLSTATE('4','2', 'P','1','7')
-
-/* Class 44 - WITH CHECK OPTION Violation */
-#define ERRCODE_WITH_CHECK_OPTION_VIOLATION MAKE_SQLSTATE('4','4', '0','0','0')
-
-/* Class 53 - Insufficient Resources (PostgreSQL-specific error class) */
-#define ERRCODE_INSUFFICIENT_RESOURCES         MAKE_SQLSTATE('5','3', '0','0','0')
-#define ERRCODE_DISK_FULL                                      MAKE_SQLSTATE('5','3', '1','0','0')
-#define ERRCODE_OUT_OF_MEMORY                          MAKE_SQLSTATE('5','3', '2','0','0')
-#define ERRCODE_TOO_MANY_CONNECTIONS           MAKE_SQLSTATE('5','3', '3','0','0')
-
-/* Class 54 - Program Limit Exceeded (class borrowed from DB2) */
-/* (this is for wired-in limits, not resource exhaustion problems) */
-#define ERRCODE_PROGRAM_LIMIT_EXCEEDED         MAKE_SQLSTATE('5','4', '0','0','0')
-#define ERRCODE_STATEMENT_TOO_COMPLEX          MAKE_SQLSTATE('5','4', '0','0','1')
-#define ERRCODE_TOO_MANY_COLUMNS                       MAKE_SQLSTATE('5','4', '0','1','1')
-#define ERRCODE_TOO_MANY_ARGUMENTS                     MAKE_SQLSTATE('5','4', '0','2','3')
-
-/* Class 55 - Object Not In Prerequisite State (class borrowed from DB2) */
-#define ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE       MAKE_SQLSTATE('5','5', '0','0','0')
-#define ERRCODE_OBJECT_IN_USE                          MAKE_SQLSTATE('5','5', '0','0','6')
-#define ERRCODE_CANT_CHANGE_RUNTIME_PARAM      MAKE_SQLSTATE('5','5', 'P','0','2')
-#define ERRCODE_LOCK_NOT_AVAILABLE                     MAKE_SQLSTATE('5','5', 'P','0','3')
-
-/* Class 57 - Operator Intervention (class borrowed from DB2) */
-#define ERRCODE_OPERATOR_INTERVENTION          MAKE_SQLSTATE('5','7', '0','0','0')
-#define ERRCODE_QUERY_CANCELED                         MAKE_SQLSTATE('5','7', '0','1','4')
-#define ERRCODE_ADMIN_SHUTDOWN                         MAKE_SQLSTATE('5','7', 'P','0','1')
-#define ERRCODE_CRASH_SHUTDOWN                         MAKE_SQLSTATE('5','7', 'P','0','2')
-#define ERRCODE_CANNOT_CONNECT_NOW                     MAKE_SQLSTATE('5','7', 'P','0','3')
-#define ERRCODE_DATABASE_DROPPED                       MAKE_SQLSTATE('5','7', 'P','0','4')
-
-/* Class 58 - System Error (class borrowed from DB2) */
-/* (we define this as errors external to PostgreSQL itself) */
-#define ERRCODE_IO_ERROR                                       MAKE_SQLSTATE('5','8', '0','3','0')
-#define ERRCODE_UNDEFINED_FILE                         MAKE_SQLSTATE('5','8', 'P','0','1')
-#define ERRCODE_DUPLICATE_FILE                         MAKE_SQLSTATE('5','8', 'P','0','2')
-
-/* Class F0 - Configuration File Error (PostgreSQL-specific error class) */
-#define ERRCODE_CONFIG_FILE_ERROR                      MAKE_SQLSTATE('F','0', '0','0','0')
-#define ERRCODE_LOCK_FILE_EXISTS                       MAKE_SQLSTATE('F','0', '0','0','1')
-
-/* Class HV - Foreign Data Wrapper Error (SQL/MED-specific error class) */
-#define ERRCODE_FDW_ERROR                                      MAKE_SQLSTATE('H','V', '0','0','0')
-#define ERRCODE_FDW_COLUMN_NAME_NOT_FOUND      MAKE_SQLSTATE('H','V', '0','0','5')
-#define ERRCODE_FDW_DYNAMIC_PARAMETER_VALUE_NEEDED     MAKE_SQLSTATE('H','V', '0','0','2')
-#define ERRCODE_FDW_FUNCTION_SEQUENCE_ERROR    MAKE_SQLSTATE('H','V', '0','1','0')
-#define ERRCODE_FDW_INCONSISTENT_DESCRIPTOR_INFORMATION        MAKE_SQLSTATE('H','V', '0','2','1')
-#define ERRCODE_FDW_INVALID_ATTRIBUTE_VALUE    MAKE_SQLSTATE('H','V', '0','2','4')
-#define ERRCODE_FDW_INVALID_COLUMN_NAME        MAKE_SQLSTATE('H','V', '0','0','7')
-#define ERRCODE_FDW_INVALID_COLUMN_NUMBER      MAKE_SQLSTATE('H','V', '0','0','8')
-#define ERRCODE_FDW_INVALID_DATA_TYPE          MAKE_SQLSTATE('H','V', '0','0','4')
-#define ERRCODE_FDW_INVALID_DATA_TYPE_DESCRIPTORS      MAKE_SQLSTATE('H','V', '0','0','6')
-#define ERRCODE_FDW_INVALID_DESCRIPTOR_FIELD_IDENTIFIER        MAKE_SQLSTATE('H','V', '0','9','1')
-#define ERRCODE_FDW_INVALID_HANDLE                     MAKE_SQLSTATE('H','V', '0','0','B')
-#define ERRCODE_FDW_INVALID_OPTION_INDEX       MAKE_SQLSTATE('H','V', '0','0','C')
-#define ERRCODE_FDW_INVALID_OPTION_NAME                MAKE_SQLSTATE('H','V', '0','0','D')
-#define ERRCODE_FDW_INVALID_STRING_LENGTH_OR_BUFFER_LENGTH     MAKE_SQLSTATE('H','V', '0','9','0')
-#define ERRCODE_FDW_INVALID_STRING_FORMAT      MAKE_SQLSTATE('H','V', '0','0','A')
-#define ERRCODE_FDW_INVALID_USE_OF_NULL_POINTER        MAKE_SQLSTATE('H','V', '0','0','9')
-#define ERRCODE_FDW_TOO_MANY_HANDLES           MAKE_SQLSTATE('H','V', '0','1','4')
-#define ERRCODE_FDW_OUT_OF_MEMORY                      MAKE_SQLSTATE('H','V', '0','0','1')
-#define ERRCODE_FDW_NO_SCHEMAS                         MAKE_SQLSTATE('H','V', '0','0','P')
-#define ERRCODE_FDW_OPTION_NAME_NOT_FOUND      MAKE_SQLSTATE('H','V', '0','0','J')
-#define ERRCODE_FDW_REPLY_HANDLE                       MAKE_SQLSTATE('H','V', '0','0','K')
-#define ERRCODE_FDW_SCHEMA_NOT_FOUND           MAKE_SQLSTATE('H','V', '0','0','Q')
-#define ERRCODE_FDW_TABLE_NOT_FOUND                    MAKE_SQLSTATE('H','V', '0','0','R')
-#define ERRCODE_FDW_UNABLE_TO_CREATE_EXECUTION MAKE_SQLSTATE('H','V', '0','0','L')
-#define ERRCODE_FDW_UNABLE_TO_CREATE_REPLY     MAKE_SQLSTATE('H','V', '0','0','M')
-#define ERRCODE_FDW_UNABLE_TO_ESTABLISH_CONNECTION     MAKE_SQLSTATE('H','V', '0','0','N')
-
-/* Class P0 - PL/pgSQL Error (PostgreSQL-specific error class) */
-#define ERRCODE_PLPGSQL_ERROR                          MAKE_SQLSTATE('P','0', '0','0','0')
-#define ERRCODE_RAISE_EXCEPTION                                MAKE_SQLSTATE('P','0', '0','0','1')
-#define ERRCODE_NO_DATA_FOUND                          MAKE_SQLSTATE('P','0', '0','0','2')
-#define ERRCODE_TOO_MANY_ROWS                          MAKE_SQLSTATE('P','0', '0','0','3')
-
-/* Class XX - Internal Error (PostgreSQL-specific error class) */
-/* (this is for "can't-happen" conditions and software bugs) */
-#define ERRCODE_INTERNAL_ERROR                         MAKE_SQLSTATE('X','X', '0','0','0')
-#define ERRCODE_DATA_CORRUPTED                         MAKE_SQLSTATE('X','X', '0','0','1')
-#define ERRCODE_INDEX_CORRUPTED                                MAKE_SQLSTATE('X','X', '0','0','2')
index 2eecb0f20defe67beb22c1633bf83b3a77ed3748..92387fa3cb1635ea212cc21dcb631c326524810c 100644 (file)
@@ -1,2 +1,3 @@
 /pl_gram.c
 /pl_gram.h
+/plerrcodes.h
index 13d971f26746fb08529e42969a1b6626c0a1fd6d..2abe63b3ad4b0377765a40dcd9e7f41aca9641c7 100644 (file)
@@ -33,7 +33,7 @@ uninstall: uninstall-lib
 
 
 # Force these dependencies to be known even without dependency info built:
-pl_gram.o pl_handler.o pl_comp.o pl_exec.o pl_funcs.o pl_scanner.o: plpgsql.h pl_gram.h
+pl_gram.o pl_handler.o pl_comp.o pl_exec.o pl_funcs.o pl_scanner.o: plpgsql.h pl_gram.h plerrcodes.h
 
 # See notes in src/backend/parser/Makefile about the following two rules
 
@@ -46,12 +46,16 @@ else
        @$(missing) bison $< $@
 endif
 
-distprep: pl_gram.h pl_gram.c
+# generate plerrcodes.h from src/backend/utils/errcodes.txt
+plerrcodes.h: $(top_srcdir)/src/backend/utils/errcodes.txt generate-plerrcodes.pl
+       $(PERL) generate-plerrcodes.pl $< > $@
 
-# pl_gram.c and pl_gram.h are in the distribution tarball,
+distprep: pl_gram.h pl_gram.c plerrcodes.h
+
+# pl_gram.c, pl_gram.h and plerrcodes.h are in the distribution tarball,
 # so they are not cleaned here.
 clean distclean: clean-lib
        rm -f $(OBJS)
 
 maintainer-clean: clean
-       rm -f pl_gram.c pl_gram.h
+       rm -f pl_gram.c pl_gram.h plerrcodes.h
diff --git a/src/pl/plpgsql/src/generate-plerrcodes.pl b/src/pl/plpgsql/src/generate-plerrcodes.pl
new file mode 100644 (file)
index 0000000..46d4b35
--- /dev/null
@@ -0,0 +1,40 @@
+#!/usr/bin/perl
+#
+# Generate the plerrcodes.h header from errcodes.txt
+# Copyright (c) 2000-2011, PostgreSQL Global Development Group
+
+use warnings;
+use strict;
+
+print "/* autogenerated from src/backend/utils/errcodes.txt, do not edit */\n";
+print "/* there is deliberately not an #ifndef PLERRCODES_H here */\n";
+
+open my $errcodes, $ARGV[0] or die;
+
+while (<$errcodes>) {
+    chomp;
+
+    # Skip comments
+    next if /^#/;
+    next if /^\s*$/;
+
+    # Skip section headers
+    next if /^Section:/;
+
+    die unless /^([^\s]{5})\s+([EWS])\s+([^\s]+)(?:\s+)?([^\s]+)?/;
+
+    (my $sqlstate,
+     my $type,
+     my $errcode_macro,
+     my $condition_name) = ($1, $2, $3, $4);
+
+    # Skip non-errors
+    next unless $type eq 'E';
+
+    # Skip lines without PL/pgSQL condition names
+    next unless defined($condition_name);
+
+    print "{\n\t\"$condition_name\", $errcode_macro\n},\n\n";
+}
+
+close $errcodes;
diff --git a/src/pl/plpgsql/src/plerrcodes.h b/src/pl/plpgsql/src/plerrcodes.h
deleted file mode 100644 (file)
index e18f3b0..0000000
+++ /dev/null
@@ -1,896 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * plerrcodes.h
- *       PL/pgSQL error codes (mapping of exception labels to SQLSTATEs)
- *
- * Eventually this header file should be auto-generated from errcodes.h
- * with some sort of sed hackery, but no time for that now.  It's likely
- * that an exact mapping will not be what's wanted anyhow ...
- *
- * Copyright (c) 2003-2011, PostgreSQL Global Development Group
- *
- * src/pl/plpgsql/src/plerrcodes.h
- *
- *-------------------------------------------------------------------------
- */
-
-/* Success and warnings can't be caught, so omit them from table */
-{
-       "sql_statement_not_yet_complete", ERRCODE_SQL_STATEMENT_NOT_YET_COMPLETE
-},
-
-{
-       "connection_exception", ERRCODE_CONNECTION_EXCEPTION
-},
-
-{
-       "connection_does_not_exist", ERRCODE_CONNECTION_DOES_NOT_EXIST
-},
-
-{
-       "connection_failure", ERRCODE_CONNECTION_FAILURE
-},
-
-{
-       "sqlclient_unable_to_establish_sqlconnection", ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION
-},
-
-{
-       "sqlserver_rejected_establishment_of_sqlconnection", ERRCODE_SQLSERVER_REJECTED_ESTABLISHMENT_OF_SQLCONNECTION
-},
-
-{
-       "transaction_resolution_unknown", ERRCODE_TRANSACTION_RESOLUTION_UNKNOWN
-},
-
-{
-       "protocol_violation", ERRCODE_PROTOCOL_VIOLATION
-},
-
-{
-       "triggered_action_exception", ERRCODE_TRIGGERED_ACTION_EXCEPTION
-},
-
-{
-       "feature_not_supported", ERRCODE_FEATURE_NOT_SUPPORTED
-},
-
-{
-       "invalid_transaction_initiation", ERRCODE_INVALID_TRANSACTION_INITIATION
-},
-
-{
-       "locator_exception", ERRCODE_LOCATOR_EXCEPTION
-},
-
-{
-       "invalid_locator_specification", ERRCODE_L_E_INVALID_SPECIFICATION
-},
-
-{
-       "invalid_grantor", ERRCODE_INVALID_GRANTOR
-},
-
-{
-       "invalid_grant_operation", ERRCODE_INVALID_GRANT_OPERATION
-},
-
-{
-       "invalid_role_specification", ERRCODE_INVALID_ROLE_SPECIFICATION
-},
-
-{
-       "case_not_found", ERRCODE_CASE_NOT_FOUND
-},
-
-{
-       "cardinality_violation", ERRCODE_CARDINALITY_VIOLATION
-},
-
-{
-       "data_exception", ERRCODE_DATA_EXCEPTION
-},
-
-{
-       "array_element_error", ERRCODE_ARRAY_ELEMENT_ERROR
-},
-
-{
-       "array_subscript_error", ERRCODE_ARRAY_SUBSCRIPT_ERROR
-},
-
-{
-       "character_not_in_repertoire", ERRCODE_CHARACTER_NOT_IN_REPERTOIRE
-},
-
-{
-       "datetime_field_overflow", ERRCODE_DATETIME_FIELD_OVERFLOW
-},
-
-{
-       "datetime_value_out_of_range", ERRCODE_DATETIME_VALUE_OUT_OF_RANGE
-},
-
-{
-       "division_by_zero", ERRCODE_DIVISION_BY_ZERO
-},
-
-{
-       "error_in_assignment", ERRCODE_ERROR_IN_ASSIGNMENT
-},
-
-{
-       "escape_character_conflict", ERRCODE_ESCAPE_CHARACTER_CONFLICT
-},
-
-{
-       "indicator_overflow", ERRCODE_INDICATOR_OVERFLOW
-},
-
-{
-       "interval_field_overflow", ERRCODE_INTERVAL_FIELD_OVERFLOW
-},
-
-{
-       "invalid_argument_for_logarithm", ERRCODE_INVALID_ARGUMENT_FOR_LOG
-},
-
-{
-       "invalid_argument_for_ntile_function", ERRCODE_INVALID_ARGUMENT_FOR_NTILE
-},
-
-{
-       "invalid_argument_for_nth_value_function", ERRCODE_INVALID_ARGUMENT_FOR_NTH_VALUE
-},
-
-{
-       "invalid_argument_for_power_function", ERRCODE_INVALID_ARGUMENT_FOR_POWER_FUNCTION
-},
-
-{
-       "invalid_argument_for_width_bucket_function", ERRCODE_INVALID_ARGUMENT_FOR_WIDTH_BUCKET_FUNCTION
-},
-
-{
-       "invalid_character_value_for_cast", ERRCODE_INVALID_CHARACTER_VALUE_FOR_CAST
-},
-
-{
-       "invalid_datetime_format", ERRCODE_INVALID_DATETIME_FORMAT
-},
-
-{
-       "invalid_escape_character", ERRCODE_INVALID_ESCAPE_CHARACTER
-},
-
-{
-       "invalid_escape_octet", ERRCODE_INVALID_ESCAPE_OCTET
-},
-
-{
-       "invalid_escape_sequence", ERRCODE_INVALID_ESCAPE_SEQUENCE
-},
-
-{
-       "invalid_indicator_parameter_value", ERRCODE_INVALID_INDICATOR_PARAMETER_VALUE
-},
-
-{
-       "invalid_parameter_value", ERRCODE_INVALID_PARAMETER_VALUE
-},
-
-{
-       "invalid_regular_expression", ERRCODE_INVALID_REGULAR_EXPRESSION
-},
-
-{
-       "invalid_row_count_in_limit_clause", ERRCODE_INVALID_ROW_COUNT_IN_LIMIT_CLAUSE
-},
-
-{
-       "invalid_row_count_in_result_offset_clause", ERRCODE_INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE
-},
-
-{
-       "invalid_time_zone_displacement_value", ERRCODE_INVALID_TIME_ZONE_DISPLACEMENT_VALUE
-},
-
-{
-       "invalid_use_of_escape_character", ERRCODE_INVALID_USE_OF_ESCAPE_CHARACTER
-},
-
-{
-       "most_specific_type_mismatch", ERRCODE_MOST_SPECIFIC_TYPE_MISMATCH
-},
-
-{
-       "null_value_not_allowed", ERRCODE_NULL_VALUE_NOT_ALLOWED
-},
-
-{
-       "null_value_no_indicator_parameter", ERRCODE_NULL_VALUE_NO_INDICATOR_PARAMETER
-},
-
-{
-       "numeric_value_out_of_range", ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE
-},
-
-{
-       "string_data_length_mismatch", ERRCODE_STRING_DATA_LENGTH_MISMATCH
-},
-
-{
-       "string_data_right_truncation", ERRCODE_STRING_DATA_RIGHT_TRUNCATION
-},
-
-{
-       "substring_error", ERRCODE_SUBSTRING_ERROR
-},
-
-{
-       "trim_error", ERRCODE_TRIM_ERROR
-},
-
-{
-       "unterminated_c_string", ERRCODE_UNTERMINATED_C_STRING
-},
-
-{
-       "zero_length_character_string", ERRCODE_ZERO_LENGTH_CHARACTER_STRING
-},
-
-{
-       "floating_point_exception", ERRCODE_FLOATING_POINT_EXCEPTION
-},
-
-{
-       "invalid_text_representation", ERRCODE_INVALID_TEXT_REPRESENTATION
-},
-
-{
-       "invalid_binary_representation", ERRCODE_INVALID_BINARY_REPRESENTATION
-},
-
-{
-       "bad_copy_file_format", ERRCODE_BAD_COPY_FILE_FORMAT
-},
-
-{
-       "untranslatable_character", ERRCODE_UNTRANSLATABLE_CHARACTER
-},
-
-{
-       "not_an_xml_document", ERRCODE_NOT_AN_XML_DOCUMENT
-},
-
-{
-       "invalid_xml_document", ERRCODE_INVALID_XML_DOCUMENT
-},
-
-{
-       "invalid_xml_content", ERRCODE_INVALID_XML_CONTENT
-},
-
-{
-       "invalid_xml_comment", ERRCODE_INVALID_XML_COMMENT
-},
-
-{
-       "invalid_xml_processing_instruction", ERRCODE_INVALID_XML_PROCESSING_INSTRUCTION
-},
-
-{
-       "integrity_constraint_violation", ERRCODE_INTEGRITY_CONSTRAINT_VIOLATION
-},
-
-{
-       "restrict_violation", ERRCODE_RESTRICT_VIOLATION
-},
-
-{
-       "not_null_violation", ERRCODE_NOT_NULL_VIOLATION
-},
-
-{
-       "foreign_key_violation", ERRCODE_FOREIGN_KEY_VIOLATION
-},
-
-{
-       "unique_violation", ERRCODE_UNIQUE_VIOLATION
-},
-
-{
-       "check_violation", ERRCODE_CHECK_VIOLATION
-},
-
-{
-       "exclusion_violation", ERRCODE_EXCLUSION_VIOLATION
-},
-
-{
-       "invalid_cursor_state", ERRCODE_INVALID_CURSOR_STATE
-},
-
-{
-       "invalid_transaction_state", ERRCODE_INVALID_TRANSACTION_STATE
-},
-
-{
-       "active_sql_transaction", ERRCODE_ACTIVE_SQL_TRANSACTION
-},
-
-{
-       "branch_transaction_already_active", ERRCODE_BRANCH_TRANSACTION_ALREADY_ACTIVE
-},
-
-{
-       "held_cursor_requires_same_isolation_level", ERRCODE_HELD_CURSOR_REQUIRES_SAME_ISOLATION_LEVEL
-},
-
-{
-       "inappropriate_access_mode_for_branch_transaction", ERRCODE_INAPPROPRIATE_ACCESS_MODE_FOR_BRANCH_TRANSACTION
-},
-
-{
-       "inappropriate_isolation_level_for_branch_transaction", ERRCODE_INAPPROPRIATE_ISOLATION_LEVEL_FOR_BRANCH_TRANSACTION
-},
-
-{
-       "no_active_sql_transaction_for_branch_transaction", ERRCODE_NO_ACTIVE_SQL_TRANSACTION_FOR_BRANCH_TRANSACTION
-},
-
-{
-       "read_only_sql_transaction", ERRCODE_READ_ONLY_SQL_TRANSACTION
-},
-
-{
-       "schema_and_data_statement_mixing_not_supported", ERRCODE_SCHEMA_AND_DATA_STATEMENT_MIXING_NOT_SUPPORTED
-},
-
-{
-       "no_active_sql_transaction", ERRCODE_NO_ACTIVE_SQL_TRANSACTION
-},
-
-{
-       "in_failed_sql_transaction", ERRCODE_IN_FAILED_SQL_TRANSACTION
-},
-
-{
-       "invalid_sql_statement_name", ERRCODE_INVALID_SQL_STATEMENT_NAME
-},
-
-{
-       "triggered_data_change_violation", ERRCODE_TRIGGERED_DATA_CHANGE_VIOLATION
-},
-
-{
-       "invalid_authorization_specification", ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION
-},
-
-{
-       "invalid_password", ERRCODE_INVALID_PASSWORD
-},
-
-{
-       "dependent_privilege_descriptors_still_exist", ERRCODE_DEPENDENT_PRIVILEGE_DESCRIPTORS_STILL_EXIST
-},
-
-{
-       "dependent_objects_still_exist", ERRCODE_DEPENDENT_OBJECTS_STILL_EXIST
-},
-
-{
-       "invalid_transaction_termination", ERRCODE_INVALID_TRANSACTION_TERMINATION
-},
-
-{
-       "sql_routine_exception", ERRCODE_SQL_ROUTINE_EXCEPTION
-},
-
-{
-       "function_executed_no_return_statement", ERRCODE_S_R_E_FUNCTION_EXECUTED_NO_RETURN_STATEMENT
-},
-
-{
-       "modifying_sql_data_not_permitted", ERRCODE_S_R_E_MODIFYING_SQL_DATA_NOT_PERMITTED
-},
-
-{
-       "prohibited_sql_statement_attempted", ERRCODE_S_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED
-},
-
-{
-       "reading_sql_data_not_permitted", ERRCODE_S_R_E_READING_SQL_DATA_NOT_PERMITTED
-},
-
-{
-       "invalid_cursor_name", ERRCODE_INVALID_CURSOR_NAME
-},
-
-{
-       "external_routine_exception", ERRCODE_EXTERNAL_ROUTINE_EXCEPTION
-},
-
-{
-       "containing_sql_not_permitted", ERRCODE_E_R_E_CONTAINING_SQL_NOT_PERMITTED
-},
-
-{
-       "modifying_sql_data_not_permitted", ERRCODE_E_R_E_MODIFYING_SQL_DATA_NOT_PERMITTED
-},
-
-{
-       "prohibited_sql_statement_attempted", ERRCODE_E_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED
-},
-
-{
-       "reading_sql_data_not_permitted", ERRCODE_E_R_E_READING_SQL_DATA_NOT_PERMITTED
-},
-
-{
-       "external_routine_invocation_exception", ERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION
-},
-
-{
-       "invalid_sqlstate_returned", ERRCODE_E_R_I_E_INVALID_SQLSTATE_RETURNED
-},
-
-{
-       "null_value_not_allowed", ERRCODE_E_R_I_E_NULL_VALUE_NOT_ALLOWED
-},
-
-{
-       "trigger_protocol_violated", ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED
-},
-
-{
-       "srf_protocol_violated", ERRCODE_E_R_I_E_SRF_PROTOCOL_VIOLATED
-},
-
-{
-       "savepoint_exception", ERRCODE_SAVEPOINT_EXCEPTION
-},
-
-{
-       "invalid_savepoint_specification", ERRCODE_S_E_INVALID_SPECIFICATION
-},
-
-{
-       "invalid_catalog_name", ERRCODE_INVALID_CATALOG_NAME
-},
-
-{
-       "invalid_schema_name", ERRCODE_INVALID_SCHEMA_NAME
-},
-
-{
-       "transaction_rollback", ERRCODE_TRANSACTION_ROLLBACK
-},
-
-{
-       "transaction_integrity_constraint_violation", ERRCODE_T_R_INTEGRITY_CONSTRAINT_VIOLATION
-},
-
-{
-       "serialization_failure", ERRCODE_T_R_SERIALIZATION_FAILURE
-},
-
-{
-       "statement_completion_unknown", ERRCODE_T_R_STATEMENT_COMPLETION_UNKNOWN
-},
-
-{
-       "deadlock_detected", ERRCODE_T_R_DEADLOCK_DETECTED
-},
-
-{
-       "syntax_error_or_access_rule_violation", ERRCODE_SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION
-},
-
-{
-       "syntax_error", ERRCODE_SYNTAX_ERROR
-},
-
-{
-       "insufficient_privilege", ERRCODE_INSUFFICIENT_PRIVILEGE
-},
-
-{
-       "cannot_coerce", ERRCODE_CANNOT_COERCE
-},
-
-{
-       "grouping_error", ERRCODE_GROUPING_ERROR
-},
-
-{
-       "windowing_error", ERRCODE_WINDOWING_ERROR
-},
-
-{
-       "invalid_recursion", ERRCODE_INVALID_RECURSION
-},
-
-{
-       "invalid_foreign_key", ERRCODE_INVALID_FOREIGN_KEY
-},
-
-{
-       "invalid_name", ERRCODE_INVALID_NAME
-},
-
-{
-       "name_too_long", ERRCODE_NAME_TOO_LONG
-},
-
-{
-       "reserved_name", ERRCODE_RESERVED_NAME
-},
-
-{
-       "datatype_mismatch", ERRCODE_DATATYPE_MISMATCH
-},
-
-{
-       "indeterminate_datatype", ERRCODE_INDETERMINATE_DATATYPE
-},
-
-{
-       "wrong_object_type", ERRCODE_WRONG_OBJECT_TYPE
-},
-
-{
-       "undefined_column", ERRCODE_UNDEFINED_COLUMN
-},
-
-{
-       "undefined_cursor", ERRCODE_UNDEFINED_CURSOR
-},
-
-{
-       "undefined_database", ERRCODE_UNDEFINED_DATABASE
-},
-
-{
-       "undefined_function", ERRCODE_UNDEFINED_FUNCTION
-},
-
-{
-       "undefined_pstatement", ERRCODE_UNDEFINED_PSTATEMENT
-},
-
-{
-       "undefined_schema", ERRCODE_UNDEFINED_SCHEMA
-},
-
-{
-       "undefined_table", ERRCODE_UNDEFINED_TABLE
-},
-
-{
-       "undefined_parameter", ERRCODE_UNDEFINED_PARAMETER
-},
-
-{
-       "undefined_object", ERRCODE_UNDEFINED_OBJECT
-},
-
-{
-       "duplicate_column", ERRCODE_DUPLICATE_COLUMN
-},
-
-{
-       "duplicate_cursor", ERRCODE_DUPLICATE_CURSOR
-},
-
-{
-       "duplicate_database", ERRCODE_DUPLICATE_DATABASE
-},
-
-{
-       "duplicate_function", ERRCODE_DUPLICATE_FUNCTION
-},
-
-{
-       "duplicate_prepared_statement", ERRCODE_DUPLICATE_PSTATEMENT
-},
-
-{
-       "duplicate_schema", ERRCODE_DUPLICATE_SCHEMA
-},
-
-{
-       "duplicate_table", ERRCODE_DUPLICATE_TABLE
-},
-
-{
-       "duplicate_alias", ERRCODE_DUPLICATE_ALIAS
-},
-
-{
-       "duplicate_object", ERRCODE_DUPLICATE_OBJECT
-},
-
-{
-       "ambiguous_column", ERRCODE_AMBIGUOUS_COLUMN
-},
-
-{
-       "ambiguous_function", ERRCODE_AMBIGUOUS_FUNCTION
-},
-
-{
-       "ambiguous_parameter", ERRCODE_AMBIGUOUS_PARAMETER
-},
-
-{
-       "ambiguous_alias", ERRCODE_AMBIGUOUS_ALIAS
-},
-
-{
-       "invalid_column_reference", ERRCODE_INVALID_COLUMN_REFERENCE
-},
-
-{
-       "invalid_column_definition", ERRCODE_INVALID_COLUMN_DEFINITION
-},
-
-{
-       "invalid_cursor_definition", ERRCODE_INVALID_CURSOR_DEFINITION
-},
-
-{
-       "invalid_database_definition", ERRCODE_INVALID_DATABASE_DEFINITION
-},
-
-{
-       "invalid_function_definition", ERRCODE_INVALID_FUNCTION_DEFINITION
-},
-
-{
-       "invalid_prepared_statement_definition", ERRCODE_INVALID_PSTATEMENT_DEFINITION
-},
-
-{
-       "invalid_schema_definition", ERRCODE_INVALID_SCHEMA_DEFINITION
-},
-
-{
-       "invalid_table_definition", ERRCODE_INVALID_TABLE_DEFINITION
-},
-
-{
-       "invalid_object_definition", ERRCODE_INVALID_OBJECT_DEFINITION
-},
-
-{
-       "with_check_option_violation", ERRCODE_WITH_CHECK_OPTION_VIOLATION
-},
-
-{
-       "insufficient_resources", ERRCODE_INSUFFICIENT_RESOURCES
-},
-
-{
-       "disk_full", ERRCODE_DISK_FULL
-},
-
-{
-       "out_of_memory", ERRCODE_OUT_OF_MEMORY
-},
-
-{
-       "too_many_connections", ERRCODE_TOO_MANY_CONNECTIONS
-},
-
-{
-       "program_limit_exceeded", ERRCODE_PROGRAM_LIMIT_EXCEEDED
-},
-
-{
-       "statement_too_complex", ERRCODE_STATEMENT_TOO_COMPLEX
-},
-
-{
-       "too_many_columns", ERRCODE_TOO_MANY_COLUMNS
-},
-
-{
-       "too_many_arguments", ERRCODE_TOO_MANY_ARGUMENTS
-},
-
-{
-       "object_not_in_prerequisite_state", ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE
-},
-
-{
-       "object_in_use", ERRCODE_OBJECT_IN_USE
-},
-
-{
-       "cant_change_runtime_param", ERRCODE_CANT_CHANGE_RUNTIME_PARAM
-},
-
-{
-       "lock_not_available", ERRCODE_LOCK_NOT_AVAILABLE
-},
-
-{
-       "operator_intervention", ERRCODE_OPERATOR_INTERVENTION
-},
-
-{
-       "query_canceled", ERRCODE_QUERY_CANCELED
-},
-
-{
-       "admin_shutdown", ERRCODE_ADMIN_SHUTDOWN
-},
-
-{
-       "crash_shutdown", ERRCODE_CRASH_SHUTDOWN
-},
-
-{
-       "cannot_connect_now", ERRCODE_CANNOT_CONNECT_NOW
-},
-
-{
-       "database_dropped", ERRCODE_DATABASE_DROPPED
-},
-
-{
-       "io_error", ERRCODE_IO_ERROR
-},
-
-{
-       "undefined_file", ERRCODE_UNDEFINED_FILE
-},
-
-{
-       "duplicate_file", ERRCODE_DUPLICATE_FILE
-},
-
-{
-       "config_file_error", ERRCODE_CONFIG_FILE_ERROR
-},
-
-{
-       "lock_file_exists", ERRCODE_LOCK_FILE_EXISTS
-},
-
-{
-       "plpgsql_error", ERRCODE_PLPGSQL_ERROR
-},
-
-{
-       "fdw_error", ERRCODE_FDW_ERROR
-},
-
-{
-       "fdw_column_name_not_found", ERRCODE_FDW_COLUMN_NAME_NOT_FOUND
-},
-
-{
-       "fdw_dynamic_parameter_value_needed", ERRCODE_FDW_DYNAMIC_PARAMETER_VALUE_NEEDED
-},
-
-{
-       "fdw_function_sequence_error", ERRCODE_FDW_FUNCTION_SEQUENCE_ERROR
-},
-
-{
-       "fdw_inconsistent_descriptor_information", ERRCODE_FDW_INCONSISTENT_DESCRIPTOR_INFORMATION
-},
-
-{
-       "fdw_invalid_attribute_value", ERRCODE_FDW_INVALID_ATTRIBUTE_VALUE
-},
-
-{
-       "fdw_invalid_column_name", ERRCODE_FDW_INVALID_COLUMN_NAME
-},
-
-{
-       "fdw_invalid_column_number", ERRCODE_FDW_INVALID_COLUMN_NUMBER
-},
-
-{
-       "fdw_invalid_data_type", ERRCODE_FDW_INVALID_DATA_TYPE
-},
-
-{
-       "fdw_invalid_data_type_descriptors", ERRCODE_FDW_INVALID_DATA_TYPE_DESCRIPTORS
-},
-
-{
-       "fdw_invalid_descriptor_field_identifier", ERRCODE_FDW_INVALID_DESCRIPTOR_FIELD_IDENTIFIER
-},
-
-{
-       "fdw_invalid_handle", ERRCODE_FDW_INVALID_HANDLE
-},
-
-{
-       "fdw_invalid_option_index", ERRCODE_FDW_INVALID_OPTION_INDEX
-},
-
-{
-       "fdw_invalid_option_name", ERRCODE_FDW_INVALID_OPTION_NAME
-},
-
-{
-       "fdw_invalid_string_length_or_buffer_length", ERRCODE_FDW_INVALID_STRING_LENGTH_OR_BUFFER_LENGTH
-},
-
-{
-       "fdw_invalid_string_format", ERRCODE_FDW_INVALID_STRING_FORMAT
-},
-
-{
-       "fdw_invalid_use_of_null_pointer", ERRCODE_FDW_INVALID_USE_OF_NULL_POINTER
-},
-
-{
-       "fdw_too_many_handles", ERRCODE_FDW_TOO_MANY_HANDLES
-},
-
-{
-       "fdw_out_of_memory", ERRCODE_FDW_OUT_OF_MEMORY
-},
-
-{
-       "fdw_no_schemas", ERRCODE_FDW_NO_SCHEMAS
-},
-
-{
-       "fdw_option_name_not_found", ERRCODE_FDW_OPTION_NAME_NOT_FOUND
-},
-
-{
-       "fdw_reply_handle", ERRCODE_FDW_REPLY_HANDLE
-},
-
-{
-       "fdw_schema_not_found", ERRCODE_FDW_SCHEMA_NOT_FOUND
-},
-
-{
-       "fdw_table_not_found", ERRCODE_FDW_TABLE_NOT_FOUND
-},
-
-{
-       "fdw_unable_to_create_execution", ERRCODE_FDW_UNABLE_TO_CREATE_EXECUTION
-},
-
-{
-       "fdw_unable_to_create_reply", ERRCODE_FDW_UNABLE_TO_CREATE_REPLY
-},
-
-{
-       "fdw_unable_to_establish_connection", ERRCODE_FDW_UNABLE_TO_ESTABLISH_CONNECTION
-},
-
-{
-       "raise_exception", ERRCODE_RAISE_EXCEPTION
-},
-
-{
-       "no_data_found", ERRCODE_NO_DATA_FOUND
-},
-
-{
-       "too_many_rows", ERRCODE_TOO_MANY_ROWS
-},
-
-{
-       "internal_error", ERRCODE_INTERNAL_ERROR
-},
-
-{
-       "data_corrupted", ERRCODE_DATA_CORRUPTED
-},
-
-{
-       "index_corrupted", ERRCODE_INDEX_CORRUPTED
-},
index b737e1ed9fcd7360f50da5e3f58b1142a61384b8..950e12b1f4c1b445fd9e2d71799eed9c775772d5 100644 (file)
@@ -273,6 +273,19 @@ s{PG_VERSION_STR "[^"]+"}{__STRINGIFY(x) #x\n#define __STRINGIFY2(z) __STRINGIFY
         );
     }
 
+    if (IsNewer('src\include\utils\errcodes.h','src\backend\utils\errcodes.txt'))
+    {
+        print "Generating errcodes.h...\n";
+        system("perl src\backend\utils\generate-errcodes.pl src\backend\utils\errcodes.txt > src\backend\utils\errcodes.h");
+        copyFile('src\backend\utils\errcodes.h','src\include\utils\errcodes.h');
+    }
+
+    if (IsNewer('src\pl\plpgsql\src\plerrcodes.h','src\backend\utils\errcodes.txt'))
+    {
+        print "Generating plerrcodes.h...\n";
+        system("perl src\pl\plpgsql\src\generate-plerrcodes.pl src\backend\utils\errcodes.txt > src\pl\plpgsql\src\plerrcodes.h");
+    }
+
     if (IsNewer('src\interfaces\libpq\libpq.rc','src\interfaces\libpq\libpq.rc.in'))
     {
         print "Generating libpq.rc...\n";
index 81c97ab6e4c036e32f09fcbe0c339bf13581c3f6..dc76c7e0484f34dd35445a86645e6fb9de29184f 100755 (executable)
@@ -32,6 +32,7 @@ SET SGML_CATALOG_FILES=%DOCROOT%\%OPENJADE%\dsssl\catalog;%DOCROOT%\docbook\docb
 perl %DOCROOT%\%DSSSL%\bin\collateindex.pl -f -g -o bookindex.sgml -N
 perl mk_feature_tables.pl YES ..\..\..\src\backend\catalog\sql_feature_packages.txt ..\..\..\src\backend\catalog\sql_features.txt > features-supported.sgml
 perl mk_feature_tables.pl NO ..\..\..\src\backend\catalog\sql_feature_packages.txt ..\..\..\src\backend\catalog\sql_features.txt > features-unsupported.sgml
+perl make-errcodes-table.pl ..\..\..\src\backend\utils\errcodes.txt > errcodes-table.sgml
 
 echo Running first build...
 %DOCROOT%\%OPENJADE%\bin\openjade -V draft-mode -wall -wno-unused-param -wno-empty -D . -c %DOCROOT%\%DSSSL%\catalog -d stylesheet.dsl -i output-html -t sgml postgres.sgml 2>&1 | findstr /V "DTDDECL catalog entries are not supported"