Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit388e75a

Browse files
committed
Replace run-time error check with assertion
The error message was checking that the structures returned from theparser matched expectations. That's something we usually useassertions for, not a full user-facing error message. So replace thatwith an assertion (hidden inside lfirst_node()).Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>Discussion:https://www.postgresql.org/message-id/flat/452e9df8-ec89-e01b-b64a-8cc6ce830458%40enterprisedb.com
1 parent2941138 commit388e75a

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

‎src/backend/commands/statscmds.c

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -220,26 +220,14 @@ CreateStatistics(CreateStatsStmt *stmt)
220220
*/
221221
foreach(cell,stmt->exprs)
222222
{
223-
Node*expr= (Node*)lfirst(cell);
224-
StatsElem*selem;
225-
HeapTupleatttuple;
226-
Form_pg_attributeattForm;
227-
TypeCacheEntry*type;
228-
229-
/*
230-
* We should not get anything else than StatsElem, given the grammar.
231-
* But let's keep it as a safety.
232-
*/
233-
if (!IsA(expr,StatsElem))
234-
ereport(ERROR,
235-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
236-
errmsg("only simple column references and expressions are allowed in CREATE STATISTICS")));
237-
238-
selem= (StatsElem*)expr;
223+
StatsElem*selem=lfirst_node(StatsElem,cell);
239224

240225
if (selem->name)/* column reference */
241226
{
242227
char*attname;
228+
HeapTupleatttuple;
229+
Form_pg_attributeattForm;
230+
TypeCacheEntry*type;
243231

244232
attname=selem->name;
245233

@@ -273,6 +261,7 @@ CreateStatistics(CreateStatsStmt *stmt)
273261
{
274262
Node*expr=selem->expr;
275263
Oidatttype;
264+
TypeCacheEntry*type;
276265

277266
Assert(expr!=NULL);
278267

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp