alter table to multi partitions

2022-02-24 Thread Catalin Maftei
hello,
on a project I have large tables, with more than 2-5.000.000 rows, and the 
system is starting to be slow,This tables have many dependencies functions, 
procedures and views.

I want to partition this tables. 

I think for this scenario for table Orders:
step1: create new table with same structure ->  Orders_Partstep 2:    
create all the partitions&triggers on new table Orders_Part
step 3:    copy/moved data from Orders to Orders_Part
step 4:    rename Orders to Orders_OldIf i want to drop Orders, it's necessary 
to drop all dependencies (and that's not what I want)
step 5:rename Orders_Part to Ordershere is the problem - when rename Orders 
to Orders_old, postgres automatically change Orders to Orders_old in all 
dependencies (views, functions, sp) 
is there any postgres setting I can use to not  automatically change the in all 
the depandencies?

-- 
- 
Best regards,
Catalin Maftei



Re: tsvector string representation and parsing

2022-02-24 Thread Tom Lane
=?UTF-8?Q?Johannes_Gra=c3=abn?=  writes:
> Before using format(), I tried just generating those strings by doubling 
> any single quote or backslash and enclosing the whole string in single 
> quotes, but that didn't seem a safe way, though it works in principle:

That's the documented requirement, so I don't see why it wouldn't be
safe.

regards, tom lane




\set \e and newline

2022-02-24 Thread Wim Bertels
Hello,

a quick question about
https://www.postgresql.org/docs/current/app-psql.html
and the \set option

it seems that \set does not interpret an 'enter' interactively the same
as an 'enter' in a short script made with \e 

###
* case 1:
postgres=# \set x 1
postgres=# select :x;
 ?column? 
--
1
###


###
* case 2:
postgres=# \e

-- enter the following the editor (the same code as above)

\set x 1
select :x;

-- save and quit

postgres=#

-- no output
-- curiosly: again \e

postgres=#\e

-- shows select 1; in the editor in v14
-- shows nothing in the editor in v13 (or recursive the content being
cut off)
###


###
variation of case 2:
postgres=# \e

-- enter the following the editor (the same code as above)

\set x 1
select :x;

-- save and quit

postgres=# select :x;
 select1select1 

  1

###


Doing the same thing with \i instead of \e does behave like i would
expect, ie the same as case 1.

This is referred to as meta-commands in de manual which are to be
affected when using \e, but \g instead of ; seems to work (while it
should be the same?)


###
variation of case 2 using \g instead of ; :
postgres=# \e

-- enter the following the editor (the same code as above)

\set x 1
select :x \g

-- save and quit

 ?column? 
--
1
(1 row)

postgres=# 
###


-- 
mvg,
Wim