Skip to content

Instantly share code, notes, and snippets.

Andres Freund anarazel

Block or report user

Report or block anarazel

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:25803f926254747ff80d32ec25749a7e
#ifdef HAVE__BUILTIN_BSWAP64
#define BSWAP64(x) __builtin_bswap64(x)
#else
#define BSWAP64(x) ((((x) << 56) & UINT64CONST(0xff00000000000000)) | \
(((x) << 40) & UINT64CONST(0x00ff000000000000)) | \
(((x) << 24) & UINT64CONST(0x0000ff0000000000)) | \
(((x) << 8) & UINT64CONST(0x000000ff00000000)) | \
(((x) >> 8) & UINT64CONST(0x00000000ff000000)) | \
(((x) >> 24) & UINT64CONST(0x0000000000ff0000)) | \
(((x) >> 40) & UINT64CONST(0x000000000000ff00)) | \
View gist:4216557
diff --git a/handler.c b/handler.c
index 13c89ec..3f21e79 100644
--- a/handler.c
+++ b/handler.c
@@ -1236,7 +1236,7 @@ static int autoview_handler (BODY *a, STATE *s)
int rc = 0;
snprintf (type, sizeof (type), "%s/%s", TYPE (a), a->subtype);
- rfc1524_mailcap_lookup (a, type, entry, M_AUTOVIEW);
+ rfc1524_mailcap_lookup (a, type, entry, s->flags & M_REPLYING ? M_COMPOSE : M_AUTOVIEW);
View gist:3910956
Session 1:
DROP TABLE IF EXISTS test_drop_concurrently ;
CREATE TABLE test_drop_concurrently(id serial primary key, data int);
INSERT INTO test_drop_concurrently(data) SELECT * FROM generate_series(1,
100);
CREATE INDEX test_drop_concurrently_data ON test_drop_concurrently(data);
SET enable_seqscan = false;
View gist:3723371
SELECT pg_current_xlog_insert_location();
pg_current_xlog_insert_location
---------------------------------
0/18C01E8
CHECKPOINT;
CREATE TABLE replication_example(id SERIAL PRIMARY KEY, somedata int, text varchar(120));
begin;
INSERT INTO replication_example(somedata, text) VALUES (1, 1);
INSERT INTO replication_example(somedata, text) VALUES (1, 2);
View gist:3714963
postgres=# CREATE TEXT SEARCH CONFIGURATION nofile ( COPY = simple);
CREATE TEXT SEARCH CONFIGURATION
Time: 210.210 ms
postgres=# ALTER TEXT SEARCH CONFIGURATION nofile DROP MAPPING FOR file;
ALTER TEXT SEARCH CONFIGURATION
Time: 2.649 ms
postgres=# SELECT * FROM ts_debug('simple', 'term1/term2');
alias | description | token | dictionaries | dictionary | lexemes
-------+-------------------+-------------+--------------+------------+---------------
file | File or path name | term1/term2 | {simple} | simple | {term1/term2}
View gist:3434542
EXPLAIN ANALYSE
SELECT COUNT(*)
FROM aps_application_instances ai
JOIN aps_service_instances si ON (ai.app_instance_id = si.app_instance_id AND si.is_basic = 'y' )
LEFT JOIN (
aps_packages_upgrade_relations pur
JOIN aps_packages pu ON (pur.app_id = pu.app_id AND pur.tgt_ver = pu.app_ver AND pu.disabled = 'n' )
) ON (ai.app_id = pur.app_id AND ai.app_ver = pur.src_ver)
LEFT JOIN aps_service_instance_operation_requests sior ON (sior.service_instance_id = si.service_instance_id AND sior.operation = 'u')
JOIN aps_external_application_instances hai ON (ai.app_instance_id = hai.app_instance_id)
View gist:3159959
DROP FUNCTION IF EXISTS easydb_count__insert_trigger() CASCADE;
DROP FUNCTION IF EXISTS easydb_count__delete_trigger() CASCADE;
DROP FUNCTION IF EXISTS easydb_count__truncate_trigger() CASCADE;
DROP FUNCTION IF EXISTS easydb_get_count(namxe);
DROP FUNCTION IF EXISTS easydb_create_count_trigger(name);
DROP FUNCTION IF EXISTS easydb_remove_count_trigger(name);
DROP TABLE IF EXISTS eadb_table_stats CASCADE;
You can’t perform that action at this time.