@@ -91,73 +91,88 @@ sub ParseHeader
91
91
# Push the data into the appropriate data structure.
92
92
# Caution: when adding new recognized OID-defining macros,
93
93
# also update src/include/catalog/renumber_oids.pl.
94
- if (/ ^DECLARE_TOAST\(\s *(\w +),\s *(\d +),\s *(\d +)\) / )
94
+ if (/ ^DECLARE_TOAST\(\s *
95
+ (?<parent_table>\w +),\s *
96
+ (?<toast_oid>\d +),\s *
97
+ (?<toast_index_oid>\d +)\s *
98
+ \) /x
99
+ )
95
100
{
96
- push @{ $catalog {toasting } },
97
- { parent_table => $1 , toast_oid => $2 , toast_index_oid => $3 };
101
+ push @{ $catalog {toasting } }, {%+};
98
102
}
99
103
elsif (
100
- / ^DECLARE_TOAST_WITH_MACRO\(\s *(\w +),\s *(\d +),\s *(\d +),\s *(\w +),\s *(\w +)\) /
104
+ / ^DECLARE_TOAST_WITH_MACRO\(\s *
105
+ (?<parent_table>\w +),\s *
106
+ (?<toast_oid>\d +),\s *
107
+ (?<toast_index_oid>\d +),\s *
108
+ (?<toast_oid_macro>\w +),\s *
109
+ (?<toast_index_oid_macro>\w +)\s *
110
+ \) /x
101
111
)
102
112
{
103
- push @{ $catalog {toasting } },
104
- {
105
- parent_table => $1 ,
106
- toast_oid => $2 ,
107
- toast_index_oid => $3 ,
108
- toast_oid_macro => $4 ,
109
- toast_index_oid_macro => $5
110
- };
113
+ push @{ $catalog {toasting } }, {%+};
111
114
}
112
115
elsif (
113
- / ^DECLARE_(UNIQUE_)?INDEX(_PKEY)?\(\s *(\w +),\s *(\d +),\s *(\w +),\s *(.+)\) /
116
+ / ^DECLARE_(UNIQUE_)?INDEX(_PKEY)?\(\s *
117
+ (?<index_name>\w +),\s *
118
+ (?<index_oid>\d +),\s *
119
+ (?<index_oid_macro>\w +),\s *
120
+ (?<index_decl>.+)\s *
121
+ \) /x
114
122
)
115
123
{
116
124
push @{ $catalog {indexing } },
117
125
{
118
126
is_unique => $1 ? 1 : 0,
119
127
is_pkey => $2 ? 1 : 0,
120
- index_name => $3 ,
121
- index_oid => $4 ,
122
- index_oid_macro => $5 ,
123
- index_decl => $6
128
+ %+,
124
129
};
125
130
}
126
- elsif (/ ^DECLARE_OID_DEFINING_MACRO\(\s *(\w +),\s *(\d +)\) / )
131
+ elsif (
132
+ / ^DECLARE_OID_DEFINING_MACRO\(\s *
133
+ (?<other_name>\w +),\s *
134
+ (?<other_oid>\d +)\s *
135
+ \) /x
136
+ )
127
137
{
128
- push @{ $catalog {other_oids } },
129
- {
130
- other_name => $1 ,
131
- other_oid => $2
132
- };
138
+ push @{ $catalog {other_oids } }, {%+};
133
139
}
134
140
elsif (
135
- / ^DECLARE_(ARRAY_)?FOREIGN_KEY(_OPT)?\(\s *\( ([^)]+)\) ,\s *(\w +),\s *\( ([^)]+)\)\) /
141
+ / ^DECLARE_(ARRAY_)?FOREIGN_KEY(_OPT)?\(\s *
142
+ \( (?<fk_cols>[^)]+)\) ,\s *
143
+ (?<pk_table>\w +),\s *
144
+ \( (?<pk_cols>[^)]+)\)\s *
145
+ \) /x
136
146
)
137
147
{
138
148
push @{ $catalog {foreign_keys } },
139
149
{
140
150
is_array => $1 ? 1 : 0,
141
151
is_opt => $2 ? 1 : 0,
142
- fk_cols => $3 ,
143
- pk_table => $4 ,
144
- pk_cols => $5
152
+ %+,
145
153
};
146
154
}
147
- elsif (/ ^CATALOG\( (\w +),(\d +),(\w +)\) / )
155
+ elsif (
156
+ / ^CATALOG\(\s *
157
+ (?<catname>\w +),\s *
158
+ (?<relation_oid>\d +),\s *
159
+ (?<relation_oid_macro>\w +)\s *
160
+ \) /x
161
+ )
148
162
{
149
- $catalog {catname } = $1 ;
150
- $catalog {relation_oid } = $2 ;
151
- $catalog {relation_oid_macro } = $3 ;
163
+ @catalog { keys %+ } = values %+;
152
164
153
165
$catalog {bootstrap } = /BKI_BOOTSTRAP/ ? ' bootstrap' : ' ' ;
154
166
$catalog {shared_relation } =
155
167
/ BKI_SHARED_RELATION/ ? ' shared_relation' : ' ' ;
156
- if (/ BKI_ROWTYPE_OID\( (\d +),(\w +)\) / )
168
+ if (/ BKI_ROWTYPE_OID\(\s *
169
+ (?<rowtype_oid>\d +),\s *
170
+ (?<rowtype_oid_macro>\w +)\s *
171
+ \) /x
172
+ )
157
173
{
158
- $catalog {rowtype_oid } = $1 ;
159
- $catalog {rowtype_oid_clause } = " rowtype_oid $1 " ;
160
- $catalog {rowtype_oid_macro } = $2 ;
174
+ @catalog { keys %+ } = values %+;
175
+ $catalog {rowtype_oid_clause } = " rowtype_oid $+ {rowtype_oid}" ;
161
176
}
162
177
else
163
178
{
0 commit comments