Skip to main content
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
Results tagged with
Search options not deleted user 6219
1 vote

setting timing on not getting time in log

\timing is a psql command - that is, it acts on the client side. If you want to know the timing of your queries on the server side (that is, written to the logs), do SET log_min_duration_statement TO …
András Váczi's user avatar
13 votes
Accepted

Is PostgreSQL JSONB @> operator equal to ->''=?

I have created a small test for checking this: CREATE TABLE jsonb_test (id serial, data jsonb); Then inserted some generated data: INSERT INTO jsonb_test (data) SELECT row_to_json(x.*)::jsonb …
András Váczi's user avatar
22 votes
Accepted

Get 10th and 90th percentile by customer

It seems you are after the percentile_disc() ordered-set aggregate function. The documentation says the following about it: percentile_disc(fraction) WITHIN GROUP (ORDER BY sort_expression) discrete …
András Váczi's user avatar
3 votes
Accepted

PostgreSQL 9.4.6 under RHEL 7 - Extensive logfile because of log_statement_stats - Can't tur...

There are multiple levels where you configuration options are set in PostgreSQL: system defaults values specified in postgresql.conf or the startup command line values preset for a database, user (m …
András Váczi's user avatar
2 votes
Accepted

Can atomic counter in trigger lead to "could not serialize access due to concurrent update"?

The actions taken in the trigger are part of the transaction that fires it. This means that the counter increment will happen only if the whole transaction (or the subtransaction defined by a SAVEPOI …
András Váczi's user avatar
2 votes
Accepted

Does index occupy disk memory for rows for which index expression is NULL?

Let's simply try it! I've created the table from your question, then did the following: INSERT INTO mytable SELECT json_object(ARRAY['myfield', i::text || 'bla'])::jsonb FROM generate_series (1, 1 …
András Váczi's user avatar
22 votes
Accepted

Same function in SELECT and WHERE clause

Let's create a function that has a side effect so that we can see how many times it is executed: CREATE OR REPLACE FUNCTION test.this_here(val integer) RETURNS numeric LANGUAGE plpgsql AS $fu …
András Váczi's user avatar
4 votes
Accepted

postgres 9.4 timeline issue

As it sounds, you are in a split brain situation. The original master (01) was never stopped from being master, and after the promotion of 02, it became just another master. Fixing such issues pre-9 …
András Váczi's user avatar
3 votes
Accepted

What is the valid string representation of tstzrange[]?

The thing is that here you have to combine two literals: '{}' for the array and '[...,...]' for the range type. In all these cases, the easiest is just getting back the output from the system itself: …
András Váczi's user avatar
1 vote

retrun multiple functions from dynamic query

It looks like indzone is a varchar(20), not a text - you could either specify the returned record using the former, or cast indzone inside the function. (This applies to the solution suggested below, …
András Váczi's user avatar
8 votes

how do you revoke create table from a user on postgresql 9.4?

According to the documentation, what one needs for creating tables in a schema is CREATE on that schema. This you think you revoked, but as you experience it didn't really happen - the only plausible …
András Váczi's user avatar
8 votes

"ERROR:malformed array literal" when using json_to_record with a JSON array element in Postg...

Just a slight variation to Chris's answer: SELECT a, translate(b, '[]', '{}')::text[] AS b, d FROM json_to_record('{"a": 1, "b": ["hello", "There"], "c": "bar"}') AS x(a int, b text, d text); The i …
András Váczi's user avatar
4 votes
Accepted

Postgresql: how to remove a GRANT on multiple tables?

The privileges are not automatically removed. Let's consult the documentation, as always: dropping a role is often not just a matter of a quick DROP ROLE. Any objects owned by the role must first …
András Váczi's user avatar
2 votes
Accepted

Create dynamic WHERE clause from a JSON field

Here is a small example to prove my point: CREATE TABLE some_data ( data hstore ); INSERT INTO some_data VALUES ('a=>bla'), ('access=>bla'), ('access=>user'); Now taking your JSO …
András Váczi's user avatar
0 votes

Can I delete a postgresql-9.x-main.log in a running cluster?

If you stop your database, it is safe to remove the log file (unless you need it for checking something later, so it is probably better to back it up somehow). Upon restart, an empty file will be cre …
András Váczi's user avatar

15 30 50 per page