PostgreSQL – Make a copy of a schema in the same database

# dump the schema into a text file as user 'postgres'
pg_dump -h localhost -n source_schema -U postgres db_name > dump.sql
# change all instances of source_schema in the dump into new_schema
sed -i 's/source_schema/new_schema/g' dump.sql
# skip all GRANT statements in the dump by commenting out
sed -i 's/GRANT/-- GRANT/g' dump.sql
# feed the dump file into psql to create new_schema as user 'postgres'
psql -h localhost -f dump.sql -U postgres db_name
# remove the dump file to clean up the file system
rm dump.sql

Some other ways:


Ubuntu – Khắc phục lỗi “Cannot move file to trash; do you want to delete immediately?”

Cách 1:

Cách 2:
Your partition should be mounted:
$ read -p “User name: ” _user
$ read -p “Partition name: ” _partition
$ _uid=”$(id -u $_user)”
$ sudo mkdir “/media/$_partition/.Trash-$_uid”
$ sudo chown “$_user /media/$_partition/.Trash-$_uid”

Cách xóa lỗi apt-get BADSIG GPG trong Linux Mint 13 (Ubuntu 12.04)

Here’s the (easiest) solution:

Type the following commands in the Terminal:

$ sudo -i 
# apt-get clean 
# cd /var/lib/apt 
# mv lists lists.old 
# mkdir -p lists/partial 
# apt-get clean 
# apt-get update 



If the error occurs again (maybe after a few days/months), open Nautilus as root > navigate to var/lib/apt > delete the "lists.old" folder > then open the "lists" folder and delete the "partial" folder. Now, execute the aforementioned commands again.