pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Getting "invalid cache ID: 42" in pg10.5
3+ messages / 3 participants
[nested] [flat]

* Getting "invalid cache ID: 42" in pg10.5
@ 2018-09-20 07:35 pcsuccess@sina.com
  2018-09-20 09:57 ` Re: Getting "invalid cache ID: 42" in pg10.5 Thomas Munro <thomas.munro@enterprisedb.com>
  0 siblings, 1 reply; 3+ messages in thread

From: pcsuccess@sina.com @ 2018-09-20 07:35 UTC (permalink / raw)
  To: pgsql-bugs

PostgreSQL version: 10.5 Operating system:   CentOS release 6.9 (Final)

Hi We're using 10.5 ,i get the error: report=> select count(1) from monitor_trade_detail where mernum_maps is not null;ERROR:  invalid cache ID: 42CONTEXT:  parallel worker
the table data count 606333
report=> \dx                                             List of installed extensions    Name    | Version |   Schema   |                                    Description                                    ------------+---------+------------+----------------------------------------------------------------------------------- jsquery    | 1.1     | report     | data type for jsonb inspection oracle_fdw | 1.1     | report     | foreign data wrapper for Oracle access plpgsql    | 1.0     | pg_catalog | PL/pgSQL procedural language tds_fdw    | 1.0.8   | report     | Foreign data wrapper for querying a TDS database (Sybase or Microsoft SQL Server)(4 rows)
It's only happening occasionally (on a not very busy system).
Many thanks 

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Getting "invalid cache ID: 42" in pg10.5
  2018-09-20 07:35 Getting "invalid cache ID: 42" in pg10.5 pcsuccess@sina.com
@ 2018-09-20 09:57 ` Thomas Munro <thomas.munro@enterprisedb.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Thomas Munro @ 2018-09-20 09:57 UTC (permalink / raw)
  To: pcsuccess@sina.com; +Cc: pgsql-bugs

On Thu, Sep 20, 2018 at 9:16 PM <pcsuccess@sina.com> wrote:
> PostgreSQL version: 10.5
> Operating system:   CentOS release 6.9 (Final)
>
>
> Hi
>
> We're using 10.5 ,i get the error:
>  report=> select count(1) from monitor_trade_detail where mernum_maps is not null;
> ERROR:  invalid cache ID: 42
> CONTEXT:  parallel worker
>
> the table data count 606333
>
> report=> \dx
>                                              List of installed extensions
>     Name    | Version |   Schema   |                                    Descri
> ption
> ------------+---------+------------+------------------------------------------
> -----------------------------------------
>  jsquery    | 1.1     | report     | data type for jsonb inspection
>  oracle_fdw | 1.1     | report     | foreign data wrapper for Oracle access
>  plpgsql    | 1.0     | pg_catalog | PL/pgSQL procedural language
>  tds_fdw    | 1.0.8   | report     | Foreign data wrapper for querying a TDS d
> atabase (Sybase or Microsoft SQL Server)
> (4 rows)
>
>
> It's only happening occasionally (on a not very busy system).

Hello,

I believe that should be fixed in the next PostgreSQL release, which
will have this recent commit:

https://www.postgresql.org/message-id/E1g2ocj-0008VB-M9%40gemulon.postgresql.org

Assuming it's the same problem, it's also possible for the extension
author to fix it.  One workaround in the meantime is to disable
parallel query in any session that might have accessed an extension
that has the problem.

-- 
Thomas Munro
http://www.enterprisedb.com




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* [PATCH] Reject MERGE in CTE
@ 2022-08-11 11:17 Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 3+ messages in thread

From: Alvaro Herrera @ 2022-08-11 11:17 UTC (permalink / raw)

---
 src/backend/parser/parse_cte.c      | 7 +++++++
 src/test/regress/expected/merge.out | 8 ++++++++
 src/test/regress/sql/merge.sql      | 5 +++++
 3 files changed, 20 insertions(+)

inline patch 1: src/backend/parser/parse_cte.c, src/test/regress/expected/merge.out, src/test/regress/sql/merge.sql (+20/-0 lines) download inline-1.patchdiff --git a/src/backend/parser/parse_cte.c b/src/backend/parser/parse_cte.c index efb4af706e..8fc8658608 100644 --- a/src/backend/parser/parse_cte.c +++ b/src/backend/parser/parse_cte.c @@ -126,6 +126,13 @@ transformWithClause(ParseState *pstate, WithClause *withClause) CommonTableExpr *cte = (CommonTableExpr *) lfirst(lc); ListCell *rest; + /* MERGE is allowed by parser, but unimplemented. Reject for now */ + if (IsA(cte->ctequery, MergeStmt)) + ereport(ERROR, + errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("MERGE not supported in WITH query"), + parser_errposition(pstate, cte->location)); + for_each_cell(rest, withClause->ctes, lnext(withClause->ctes, lc)) { CommonTableExpr *cte2 = (CommonTableExpr *) lfirst(rest); diff --git a/src/test/regress/expected/merge.out b/src/test/regress/expected/merge.out index af670e28e7..21609eba63 100644 --- a/src/test/regress/expected/merge.out +++ b/src/test/regress/expected/merge.out @@ -123,6 +123,14 @@ ON tid = tid WHEN MATCHED THEN DO NOTHING; ERROR: name "target" specified more than once DETAIL: The name is used both as MERGE target table and data source. +-- used in a CTE +WITH foo AS ( + MERGE INTO target USING source ON (true) +WHEN MATCHED THEN DELETE +) SELECT * FROM foo; +ERROR: MERGE not supported in WITH query +LINE 1: WITH foo AS ( + ^ -- unsupported relation types -- view CREATE VIEW tv AS SELECT * FROM target; diff --git a/src/test/regress/sql/merge.sql b/src/test/regress/sql/merge.sql index afeb212f3c..a3e9d36fe3 100644 --- a/src/test/regress/sql/merge.sql +++ b/src/test/regress/sql/merge.sql @@ -88,6 +88,11 @@ MERGE INTO target USING target ON tid = tid WHEN MATCHED THEN DO NOTHING; +-- used in a CTE +WITH foo AS ( + MERGE INTO target USING source ON (true) +WHEN MATCHED THEN DELETE +) SELECT * FROM foo; -- unsupported relation types -- view -- 2.30.2
--54exrjnke3mqqaau-- ^ permalink raw reply [nested|flat] 3+ messages in thread


end of thread, other threads:[~2022-08-11 11:17 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-09-20 07:35 Getting "invalid cache ID: 42" in pg10.5 pcsuccess@sina.com
2018-09-20 09:57 ` Thomas Munro <thomas.munro@enterprisedb.com>
2022-08-11 11:17 [PATCH] Reject MERGE in CTE Alvaro Herrera <alvherre@alvh.no-ip.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox