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
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Favorites infavorites:mine
infavorites:1234
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 answers only user 1822

PostgreSQL version 9.2

0
votes
createdb is a commandline tool which should be run in a Windows commandline window ("Start -> Run -> "cmd.exe"). You have to have PostgreSQL's bin directory in the windows PATH in order for this to wo …
answered Jan 5 '13 by a_horse_with_no_name
3
votes
Don't mess with the data files in the filesystem it's a sure way to get your database corrupted. You can achieve what you want, by creating a tablespace and then move the table to the new tablespace: …
answered Dec 30 '13 by a_horse_with_no_name
2
votes
Assuming the "first" is defined through the id column in the child table, something like this should work: select p.id, p.name, c.name from parent p join ( select c.name, c.paren …
answered Apr 21 '13 by a_horse_with_no_name
3
votes
I think you are looking for conditional aggregation: SELECT b.WorkflowID, count(case when a.creationtime <= timestamp '2015-06-10 14:00:00' then b.worflowid end) as count_before, sum( …
answered Jun 10 '15 by a_horse_with_no_name
1
vote
You can use the following statement to synchronize the sequence with the current max value of the ID column: select setval(pg_get_serial_sequence('dummy', 'id'), (select max(id) from dummy)); Onlin …
answered Jul 22 by a_horse_with_no_name
1
vote
This can be done using a window function: select name, city, cnt from ( select name, city, count(*) over (partition by name) as cnt from names ) t where cnt > 1;
answered Jul 15 '16 by a_horse_with_no_name
1
vote
This can be achieved by using a unique index on the combination of counter and the month of date_booked. Something like this: create unique index idx_tbl on tbl (counter, to_char(date_booked, 'yyyymm …
answered Jul 10 '14 by a_horse_with_no_name
3
votes
I do agree with Aaron, that not creating a PK (or unique constraint) is a very strange requirement But you could do something like this: insert into b (id_b, id_a) select 1, 2 where exists (select …
answered Feb 10 '15 by a_horse_with_no_name
3
votes
select a.host, b.host, b.volume from hosts as a join hosts as b on b.volume like '%'||a.volume||'%' and a.host <> b.host; Instead of LIKE you can also use position which might be easier t …
answered Aug 18 '14 by a_horse_with_no_name
1
vote
Queries for greatest-n-per-group can be solved using window functions: select note_id, size, id from ( select note_id, size, id, row_number() over (partition by note_id order by size de …
answered May 30 '16 by a_horse_with_no_name
3
votes
The only thing I can think of is to check pg_stat_activity.application_name and see if any session with pg_dump (or pg_restore) is currently active. application_name is a value supplied by the cli …
answered May 16 '17 by a_horse_with_no_name
10
votes
group is a reserved word (and by is another reserved word) - it's not GROUP BY that is reserved. Because it is a reserved word, it cannot be used directly as an identifier. To use a reserved word or …
answered Oct 26 '13 by a_horse_with_no_name
6
votes
You don't need a the function at all, this can be done with a single SQL statement: with recursive tree as (id, parent) ( select link as id, parent from linktable where id = i …
answered Mar 21 '13 by a_horse_with_no_name
5
votes
If you want the distinct keywords then you need to count the keyword_id, not the position column. So your expression: COUNT(CASE WHEN position BETWEEN 4 AND 10 THEN position ELSE NULL END ) become …
answered May 23 '14 by a_horse_with_no_name
1
vote
You can easily use a variable when doing something like this: menu_date := menu_date + interval '1' year * num_years Where num_years holds the number of years that should be added. You get the err …
answered Sep 27 '13 by a_horse_with_no_name

15 30 50 per page