3 # Generate the pltclerrcodes.h header from errcodes.txt
4 # Copyright (c) 2000-2021, PostgreSQL Global Development Group
10 "/* autogenerated from src/backend/utils/errcodes.txt, do not edit */\n";
11 print "/* there is deliberately not an #ifndef PLTCLERRCODES_H here */\n";
13 open my $errcodes, '<', $ARGV[0] or die;
23 # Skip section headers
26 die unless /^([^\s]{5})\s+([EWS])\s+([^\s]+)(?:\s+)?([^\s]+)?/;
28 (my $sqlstate, my $type, my $errcode_macro, my $condition_name) =
32 next unless $type eq 'E';
34 # Skip lines without PL/pgSQL condition names
35 next unless defined($condition_name);
37 print "\n{\n\t\"$condition_name\", $errcode_macro\n},\n";