postgresql

How to pack blobstorage with Plone and RelStorage

情到浓时终转凉″ 提交于 2021-02-10 05:31:19
问题 I have run zodbpack on my local build and reduced my data.fs and blobstorage significantly (like to <50%). When i run zodbpack on the test server the postgres 'zodb' database packs and comes down in size, but the blobstorage doesnt budge in size. I've tried running it with every combo of blob-dir /mnt/drbd/blobstorage I can think of, but it doesnt budge. Can it be packed? RelStorage = 1.5.1 I'm considering upgarding RelStorage to 1.6.0, not sure if that will help. Update: Now running

How to safely execute custom statements within JOOQ's `ExecuteListener`?

六眼飞鱼酱① 提交于 2021-02-10 05:24:38
问题 I have a custom ExecuteListener that executes additional statements before the statement JOOQ is currently looking at: @Override public void executeStart(ExecuteContext ctx) { if (ctx.type() != READ) { Timestamp nowTimestamp = Timestamp.from(Instant.now()); UUID user = auditFields.currentUserId(); // NOT the Postgres user! Connection conn = ctx.connection(); try (Statement auditUserStmt = conn.createStatement(); Statement auditTimestampStmt = conn.createStatement()) { // hand down context

How to safely execute custom statements within JOOQ's `ExecuteListener`?

笑着哭i 提交于 2021-02-10 05:24:05
问题 I have a custom ExecuteListener that executes additional statements before the statement JOOQ is currently looking at: @Override public void executeStart(ExecuteContext ctx) { if (ctx.type() != READ) { Timestamp nowTimestamp = Timestamp.from(Instant.now()); UUID user = auditFields.currentUserId(); // NOT the Postgres user! Connection conn = ctx.connection(); try (Statement auditUserStmt = conn.createStatement(); Statement auditTimestampStmt = conn.createStatement()) { // hand down context

Get Row's Sequence (Linked-List) in PostgreSQL

不想你离开。 提交于 2021-02-10 05:21:20
问题 I have a submissions table which is essentially a single linked list. Given the id of a given row I want to return the entire list that particular row is a part of (and it be in the proper order). For example in the table below if had id 2 I would want to get back rows 1,2,3,4 in that order. (4,3) -> (3,2) -> (2,1) -> (1,null) I expect 1,2,3,4 here because 4 is essentially the head of the list that 2 belongs to and I want to traverse all the through the list. http://sqlfiddle.com/#!15/c352e/1

PostgreSQL + Rails: is it possible to have a write-only database user in PG?

孤人 提交于 2021-02-10 03:18:27
问题 I am building a JSON API in Ruby on Rails. I want to have write-only user accounts that are supposed to feed data to the system but who should not be allowed to read from it. In order to achieve an extra layer of security, I'd like to enforce this rule at the database level. The idea is to have a "writer" type of user which uses a separate connection to the database. This connection should be allowed to insert / update / delete but not to select. I have everything set up nicely but

PostgreSQL + Rails: is it possible to have a write-only database user in PG?

有些话、适合烂在心里 提交于 2021-02-10 03:16:31
问题 I am building a JSON API in Ruby on Rails. I want to have write-only user accounts that are supposed to feed data to the system but who should not be allowed to read from it. In order to achieve an extra layer of security, I'd like to enforce this rule at the database level. The idea is to have a "writer" type of user which uses a separate connection to the database. This connection should be allowed to insert / update / delete but not to select. I have everything set up nicely but

PostgreSQL + Rails: is it possible to have a write-only database user in PG?

。_饼干妹妹 提交于 2021-02-10 03:15:56
问题 I am building a JSON API in Ruby on Rails. I want to have write-only user accounts that are supposed to feed data to the system but who should not be allowed to read from it. In order to achieve an extra layer of security, I'd like to enforce this rule at the database level. The idea is to have a "writer" type of user which uses a separate connection to the database. This connection should be allowed to insert / update / delete but not to select. I have everything set up nicely but

PostgreSQL + Rails: is it possible to have a write-only database user in PG?

ε祈祈猫儿з 提交于 2021-02-10 03:15:12
问题 I am building a JSON API in Ruby on Rails. I want to have write-only user accounts that are supposed to feed data to the system but who should not be allowed to read from it. In order to achieve an extra layer of security, I'd like to enforce this rule at the database level. The idea is to have a "writer" type of user which uses a separate connection to the database. This connection should be allowed to insert / update / delete but not to select. I have everything set up nicely but

Making an empty output from psql

情到浓时终转凉″ 提交于 2021-02-09 11:55:29
问题 I am running a psql command that executes a complex query. There's nothing that query produces, as such, psql returns "(No rows)" in the output. Is there a way to make psql to return an empty string? I've tried using --pset=tuples-only=on and --pset=footer=off and -q in all variations, and it doesn't seem to work. Footer option works while in psql shell prompt, but doesn't work from script. Tried on 9.1.7, need this for 8.4, 9.1 and 9.2. 回答1: May be good enough: $ psql -Axt -c 'select 1 where

Making an empty output from psql

有些话、适合烂在心里 提交于 2021-02-09 11:55:14
问题 I am running a psql command that executes a complex query. There's nothing that query produces, as such, psql returns "(No rows)" in the output. Is there a way to make psql to return an empty string? I've tried using --pset=tuples-only=on and --pset=footer=off and -q in all variations, and it doesn't seem to work. Footer option works while in psql shell prompt, but doesn't work from script. Tried on 9.1.7, need this for 8.4, 9.1 and 9.2. 回答1: May be good enough: $ psql -Axt -c 'select 1 where