Postgresql Error Codes 42601
Contents |
8.3 / 8.4 / 9.0 PostgreSQL 8.1.23 Documentation Prev Fast Backward Fast Forward Next Appendix A. PostgreSQL Error Codes All messages emitted by the PostgreSQL server are assigned five-character error codes that follow the sql state 42601 db2 SQL standard's conventions for "SQLSTATE" codes. Applications that need to know which error condition has error 42601 syntax error at or near occurred should usually test the error code, rather than looking at the textual error message. The error codes are less likely to error code: -104, sql state: 42601 db2 change across PostgreSQL releases, and also are not subject to change due to localization of error messages. Note that some, but not all, of the error codes produced by PostgreSQL are defined by the SQL standard; some additional 08p01 postgresql error codes for conditions not defined by the standard have been invented or borrowed from other databases. According to the standard, the first two characters of an error code denote a class of errors, while the last three characters indicate a specific condition within that class. Thus, an application that does not recognize the specific error code may still be able to infer what to do from the error class. Table A-1 lists all the
Redshift Error 42601
error codes defined in PostgreSQL 8.1.23. (Some are not actually used at present, but are defined by the SQL standard.) The error classes are also shown. For each error class there is a "standard" error code having the last three characters 000. This code is used only for error conditions that fall within the class but do not have any more-specific code assigned. The PL/pgSQL condition name for each error code is the same as the phrase shown in the table, with underscores substituted for spaces. For example, code 22012, DIVISION BY ZERO, has condition name DIVISION_BY_ZERO. Condition names can be written in either upper or lower case. (Note that PL/pgSQL does not recognize warning, as opposed to error, condition names; those are classes 00, 01, and 02.) Table A-1. PostgreSQL Error Codes Error Code Meaning Constant Class 00 — Successful Completion 00000 SUCCESSFUL COMPLETION successful_completion Class 01 — Warning 01000 WARNING warning 0100C DYNAMIC RESULT SETS RETURNED dynamic_result_sets_returned 01008 IMPLICIT ZERO BIT PADDING implicit_zero_bit_padding 01003 NULL VALUE ELIMINATED IN SET FUNCTION null_value_eliminated_in_set_function 01007 PRIVILEGE NOT GRANTED privilege_not_granted 01006 PRIVILEGE NOT REVOKED privilege_not_revoked 01004 STRING DATA RIGHT TRUNCATION string_data_right_truncation 01P01 DEPRECATED FEATURE deprecated_feature Class 02 — No Data (this is also a warning class per the SQL standard) 02000 NO DATA no_data 02001 NO ADDITIONAL DYNAMIC RESULT SETS RETURNED no_additional_dynamic_result_sets_returned Class 03 â€
pgsql-announce pgsql-bugs pgsql-docs pgsql-general pgsql-interfaces pgsql-jobs pgsql-novice pgsql-performance pgsql-php pgsql-sql pgsql-students Developer lists Regional lists Associations User groups Project lists Inactive lists IRC Local User Groups Featured
Postgresql Sqlstate
Users International Sites Propaganda Resources Weekly News SQL state 42601 FOR postgres error codes syntax error From: "Ramroth, Laurie"
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this http://stackoverflow.com/questions/20282639/postgresql-sql-state-42601-on-select-into site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question https://hackage.haskell.org/package/postgresql-error-codes/docs/PostgreSQL-ErrorCodes.html x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up PostgreSQL error codes sql-state: 42601 on SELECT INTO up vote 0 down vote favorite Well, i'm trying to create a simple procedure, that check if user with such login, and if no - adding new row in users table. But stuck with unexpected problem. CREATE OR REPLACE FUNCTION register_user(character varying, character varying, character varying,character varying,character varying) RETURNS bigint AS $BODY$ DECLARE new_user_login ALIAS FOR $1; new_user_password ALIAS postgresql error codes FOR $2; new_user_email ALIAS FOR $3; new_user_first_name ALIAS FOR $4; new_user_last_name ALIAS FOR $5; login_exist bigint; new_user_id bigint; emails_array character varying array; --yep, it's array of emails BEGIN SELECT INTO login_exist count(login) FROM users WHERE users.login = new_user_login; IF (login_exist = 0) THEN SELECT array_append(emails_array, new_user_email); INSERT INTO users (login,password,emails,first_name,last_name) VALUES (new_user_login,new_user_password,emails_array,new_user_first_name,new_user_last_name) RETURNING id INTO new_user_id; RETURN new_user_id; ELSE RETURN 0; END IF; END $BODY$ LANGUAGE plpgsql VOLATILE COST 100; It returns sql-state: 42601 on SELECT INTO. But if only count is 0. When login is exist it correctly return 0; What the problem is? I'm even have no idea what is this. thx for help; postgresql plpgsql share|improve this question asked Nov 29 '13 at 9:43 GeraldIstar 8819 Should that not be SELECT
the SQL standard)Class 03 -- SQL Statement Not Yet CompleteClass 08 -- Connection ExceptionClass 09 -- Triggered Action ExceptionClass 0A -- Feature Not SupportedClass 0B -- Invalid Transaction InitiationClass 0F -- Locator ExceptionClass 0L -- Invalid GrantorClass 0P -- Invalid Role SpecificationClass 0Z -- Diagnostics ExceptionClass 20 -- Case Not FoundClass 21 -- Cardinality ViolationClass 22 -- Data ExceptionClass 23 -- Integrity Constraint ViolationClass 24 -- Invalid Cursor StateClass 25 -- Invalid Transaction StateClass 26 -- Invalid SQL Statement NameClass 27 -- Triggered Data Change ViolationClass 28 -- Invalid Authorization SpecificationClass 2B -- Dependent Privilege Descriptors Still ExistClass 2D -- Invalid Transaction TerminationClass 2F -- SQL Routine ExceptionClass 34 -- Invalid Cursor NameClass 38 -- External Routine ExceptionClass 39 -- External Routine Invocation ExceptionClass 3B -- Savepoint ExceptionClass 3D -- Invalid Catalog NameClass 3F -- Invalid Schema NameClass 40 -- Transaction RollbackClass 42 -- Syntax Error or Access Rule ViolationClass 44 -- WITH CHECK OPTION ViolationClass 53 -- Insufficient ResourcesClass 54 -- Program Limit ExceededClass 55 -- Object Not In Prerequisite StateClass 57 -- Operator InterventionClass 58 -- System Error (errors external to PostgreSQL itself)Class F0 -- Configuration File ErrorClass HV -- Foreign Data Wrapper Error (SQL/MED)Class P0 -- PL/pgSQL ErrorClass XX -- Internal ErrorDescriptionError codes as per http://www.postgresql.org/docs/current/interactive/errcodes-appendix.html.Synopsistype ErrorCode = ByteStringsuccessful_completion :: ErrorCodewarning :: ErrorCodedynamic_result_sets_returned :: ErrorCodeimplicit_zero_bit_padding :: ErrorCodenull_value_eliminated_in_set_function :: ErrorCodeprivilege_not_granted :: ErrorCodeprivilege_not_revoked :: ErrorCodestring_data_right_truncation :: ErrorCodedeprecated_feature :: ErrorCodeno_data :: ErrorCodeno_additional_dynamic_result_sets_returned :: ErrorCodesql_statement_not_yet_complete :: ErrorCodeconnection_exception :: ErrorCodeconnection_does_not_exist :: ErrorCodeconnection_failure :: ErrorCodesqlclient_unable_to_establish_sqlconnection :: ErrorCodesqlserver_rejected_establishment_of_sqlconnection :: Err