Skip to content

Commit

Permalink
fix up the macro
Browse files Browse the repository at this point in the history
  • Loading branch information
Tishj committed Jun 18, 2024
1 parent 65e4345 commit b40716e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
11 changes: 7 additions & 4 deletions include/quack/quack_error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,18 @@ extern "C" {
};

#define elog_quack(elevel, ...) \
quack::Logger::GetLock().lock(); \
do { \
auto &l = quack::Logger::GetLock(); \
l.lock(); \
PG_TRY(); \
{ \
ereport(elevel, errmsg_internal(__VA_ARGS__)); \
} \
PG_CATCH(); \
PG_CATCH(); \
{ \
quack::Logger::GetLock().unlock(); \
l.unlock(); \
PG_RE_THROW(); \
} \
quack::Logger::GetLock().unlock(); \
PG_END_TRY(); \
l.unlock(); \
} while(0)
3 changes: 2 additions & 1 deletion src/quack_planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ quack_create_plan(Query *query, const char *queryString, ParamListInfo boundPara
Form_pg_type typtup;

tp = SearchSysCache1(TYPEOID, ObjectIdGetDatum(postgresColumnOid));
if (!HeapTupleIsValid(tp))
if (!HeapTupleIsValid(tp)) {
elog_quack(ERROR, "cache lookup failed for type %u", postgresColumnOid);
}

typtup = (Form_pg_type)GETSTRUCT(tp);

Expand Down

0 comments on commit b40716e

Please sign in to comment.