public inbox for [email protected]  
help / color / mirror / Atom feed
Userland copy of pg_statistic - is there a solution?
3+ messages / 2 participants
[nested] [flat]

* Userland copy of pg_statistic - is there a solution?
@ 2024-09-30 07:31 Vinícius Abrahão <[email protected]>
  2024-09-30 10:05 ` Re: Userland copy of pg_statistic - is there a solution? Laurenz Albe <[email protected]>
  2024-10-03 11:29 ` Re: Userland copy of pg_statistic - is there a solution? Vinícius Abrahão <[email protected]>
  0 siblings, 2 replies; 3+ messages in thread

From: Vinícius Abrahão @ 2024-09-30 07:31 UTC (permalink / raw)
  To: [email protected]

Morning,

postgres=# create table backup_pg_statistic as select * from pg_statistic;
2024-09-30 08:25:56 BST [7400]:
user=vinnix,db=postgres,app=psql,client=[local] ERROR:  column "stavalues1"
has pseudo-type anyarray
2024-09-30 08:25:56 BST [7400]:
user=vinnix,db=postgres,app=psql,client=[local] STATEMENT:  create table
backup_pg_statistic as select * from pg_statistic;
ERROR:  column "stavalues1" has pseudo-type anyarray
Time: 9.544 ms
postgres=# create table test_array(a anyarray);
2024-09-30 08:26:40 BST [7400]:
user=vinnix,db=postgres,app=psql,client=[local] ERROR:  column "a" has
pseudo-type anyarray
2024-09-30 08:26:40 BST [7400]:
user=vinnix,db=postgres,app=psql,client=[local] STATEMENT:  create table
test_array(a anyarray);
ERROR:  column "a" has pseudo-type anyarray
Time: 9.137 ms
Is there a solution for this simple problem?

Cheers,
Vinícius


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

* Re: Userland copy of pg_statistic - is there a solution?
  2024-09-30 07:31 Userland copy of pg_statistic - is there a solution? Vinícius Abrahão <[email protected]>
@ 2024-09-30 10:05 ` Laurenz Albe <[email protected]>
  1 sibling, 0 replies; 3+ messages in thread

From: Laurenz Albe @ 2024-09-30 10:05 UTC (permalink / raw)
  To: Vinícius Abrahão <[email protected]>; [email protected]

On Mon, 2024-09-30 at 08:31 +0100, Vinícius Abrahão wrote:
> postgres=# create table backup_pg_statistic as select * from pg_statistic;
> 2024-09-30 08:25:56 BST [7400]: user=vinnix,db=postgres,app=psql,client=[local] ERROR:  column "stavalues1" has pseudo-type anyarray
> 2024-09-30 08:25:56 BST [7400]: user=vinnix,db=postgres,app=psql,client=[local] STATEMENT:  create table backup_pg_statistic as select * from pg_statistic;
> ERROR:  column "stavalues1" has pseudo-type anyarray
> Time: 9.544 ms
> postgres=# create table test_array(a anyarray);
> 2024-09-30 08:26:40 BST [7400]: user=vinnix,db=postgres,app=psql,client=[local] ERROR:  column "a" has pseudo-type anyarray
> 2024-09-30 08:26:40 BST [7400]: user=vinnix,db=postgres,app=psql,client=[local] STATEMENT:  create table test_array(a anyarray);
> ERROR:  column "a" has pseudo-type anyarray
> Time: 9.137 ms
> 
> 
> Is there a solution for this simple problem?

Use a text[] for your copy of the stavalues* columns.

Yours,
Laurenz Albe






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

* Re: Userland copy of pg_statistic - is there a solution?
  2024-09-30 07:31 Userland copy of pg_statistic - is there a solution? Vinícius Abrahão <[email protected]>
@ 2024-10-03 11:29 ` Vinícius Abrahão <[email protected]>
  1 sibling, 0 replies; 3+ messages in thread

From: Vinícius Abrahão @ 2024-10-03 11:29 UTC (permalink / raw)
  To: [email protected]

On Mon, Sep 30, 2024 at 8:31 AM Vinícius Abrahão <[email protected]>
wrote:

>
> Morning,
>
> postgres=# create table backup_pg_statistic as select * from pg_statistic;
> 2024-09-30 08:25:56 BST [7400]:
> user=vinnix,db=postgres,app=psql,client=[local] ERROR:  column "stavalues1"
> has pseudo-type anyarray
> 2024-09-30 08:25:56 BST [7400]:
> user=vinnix,db=postgres,app=psql,client=[local] STATEMENT:  create table
> backup_pg_statistic as select * from pg_statistic;
> ERROR:  column "stavalues1" has pseudo-type anyarray
> Time: 9.544 ms
> postgres=# create table test_array(a anyarray);
> 2024-09-30 08:26:40 BST [7400]:
> user=vinnix,db=postgres,app=psql,client=[local] ERROR:  column "a" has
> pseudo-type anyarray
> 2024-09-30 08:26:40 BST [7400]:
> user=vinnix,db=postgres,app=psql,client=[local] STATEMENT:  create table
> test_array(a anyarray);
> ERROR:  column "a" has pseudo-type anyarray
> Time: 9.137 ms
> Is there a solution for this simple problem?
>
> Cheers,
> Vinícius
>

Following up my own question - I could overcome this limitation observing
the parameter allow_system_table_mods

postgres=# set allow_system_table_mods to on;
SET
Time: 5.190 ms
postgres=# create table a(a anyarray) ;
CREATE TABLE
Time: 132.959 ms

This is verified at heap_create_with_catalog(...). PostgreSQL code
https://github.com/postgres/postgres/blob/master/src/backend/catalog/heap.c#L1151


If someone needs a patch let me know to make it work for other users. We
can work on this together.

--
vinnix
aka: Vinícius Abrahão Bazana Schmidt
twitter.com/vischmidt


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


end of thread, other threads:[~2024-10-03 11:29 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-09-30 07:31 Userland copy of pg_statistic - is there a solution? Vinícius Abrahão <[email protected]>
2024-09-30 10:05 ` Laurenz Albe <[email protected]>
2024-10-03 11:29 ` Vinícius Abrahão <[email protected]>

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