Skip to content

Commit c994d30

Browse files
authored
update (github#532)
1 parent feb2cdd commit c994d30

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

timescaledb/how-to-guides/psql-basics.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@ For an in-depth breakdown of all commands, visit [psql's documentation](https://
99

1010
## Connections
1111

12-
* Connect to a PostgreSQL/TimescaleDB server via psql (using parameter flags):
12+
Connect to a PostgreSQL/TimescaleDB server via psql (using parameter flags):
1313

1414
```bash
1515
psql -h host_name -p port -U username -W -d database_name
1616
```
1717

18-
* Connect to a PostgreSQL/TimescaleDB server via psql (using a service URL):
18+
Connect to a PostgreSQL/TimescaleDB server via psql (using a service URL):
1919

2020
```bash
2121
psql "your_service_URL"
2222
```
2323

24-
* Show your psql version
24+
Show your psql version
2525
```bash
2626
psql --version
2727
```
@@ -98,7 +98,7 @@ The commands in this section can be used to import and export CSV files from you
9898

9999
<tab label="Export">
100100

101-
```
101+
```sql
102102
\copy (SELECT * FROM table_name) TO 'output_file.csv' WITH CSV HEADER
103103

104104
```
@@ -116,36 +116,36 @@ The commands in this section use the `pg_dump` and `pg_dumpall` tools.
116116
Create a backup for a specific database in plan-text SQL script file
117117
(with default backup options)
118118

119-
```sql
119+
```bash
120120
pg_dump database_name > database_name.bak.sql
121121
```
122122

123123
Creates a backup for a specific database in plan-text SQL script file (with customized backup options)
124124

125-
```
125+
```bash
126126
pg_dump -c -C -F p -f database_name.bak.sql database_name
127127
```
128128

129129
Run pg_dump on a client computer to back up data on a remote Postgres server
130130

131-
```
131+
```bash
132132
pg_dump -h remote_host -p port -U user -f database_name.bak mydb
133133
```
134134

135135
Backup all databases along with database roles and cluster-wide information
136136

137-
```
137+
```bash
138138
pg_dumpall > alldb.bak.sql
139139
```
140140

141141
Restore the database plain-text backup generated by pg_dump or pg_dumpall
142142

143-
```
143+
```bash
144144
psql -U username -f filename.sql
145145
```
146146

147147
Restore the database custom-archive backup (.bak)
148148

149-
```
149+
```bash
150150
pg_restore -d database_name /path/to/your/file/database_name.bak -c -U database_user
151151
```

0 commit comments

Comments
 (0)