Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Specifically for PostgreSQL version 9.5
3
votes
Accepted
How to modify a Postgres tablespace location
The tablespace location is defined by a symbolic link in the pg_tblspc directory (this is why, by the way, you can only use custom tablespaces on systems that have symlinks, as stated in the documenta …
4
votes
Accepted
how to combine multiple timestamps and keep the most recent one?
You need the greatest() function:
SELECT greatest(now(),
now() + interval '1 minute',
CURRENT_DATE::timestamptz,
NULL);
greatest …
3
votes
Accepted
Is it possible to modify postgresql.conf using pg_ctl?
Reading the documentation page for pg_ctl carefully shows you what happens with the stuff you pass to it using -o:
-o options
Specifies options to be passed directly to the postgres command; …
10
votes
Accepted
Execute a series of commands in PSQL
If you are using psql 9.6+, there is a very convenient command called \gexec:
Sends the current query input buffer to the server, then treats each
column of each row of the query's output (if an …
1
vote
Accepted
postgresql replay_location in pg_stat_replication is empty
It looks like you are seeing this on the master. The documentation says this about replay_location:
Last transaction log position replayed into the database on this standby server
If this DB wa …
2
votes
How to retrieve the value of deleted key in jsonb?
The below function won't work on keys that are inside arrays. If you want something like that, you'll first have to define the behaviour for such JSON structures.
The main idea is to create a table …
5
votes
Use psql --set variable in a function
An interesting way of achieving this is using a psql variable to store the whole function body, like
\set body '$$SELECT 1$$'
CREATE FUNCTION bla() RETURNS integer LANGUAGE SQL AS :c;
SELECT bla(); …
7
votes
Accepted
Use specific array column in the where clause
You put the cast outside the array constructor - use ::varchar[] instead. The current query will return you the array literal (which is of type varchar) instead of an actual array - see the example S …
1
vote
How to transfer DDL changes between different stages?
There are some. The most reliable I've seen so far (at least when the development process is also have to be considered) is having diffs.
Basically, all DB objects (tables, types, functions, etc.) a …
3
votes
Accepted
naming a column differently then its original one in foreign data wrapper of PostgreSQL
You can name the columns of your foreign table whatever you want. For example, after an IMPORT FOREIGN SCHEMA ... you can do
ALTER FOREIGN TABLE myschema.mytable RENAME a_column TO another_column;
…
11
votes
Accepted
Why do my queries take longer together than when I run them separately?
Debunking
If you are doing all your updates in the same transaction, each of them will have to work an increasingly bigger set of (physical) tuples. See the following example:
CREATE TABLE explode …