select * from pg_stat_all_tables where schemaname = 'short_message_db' and relname = 'dt_msg'; select * from pg_statio_all_tables where schemaname = 'short_message_db' and relname = 'dt_msg';
Tuesday, April 23, 2019
postgreSQL: get some table statistics
Labels:
postgresql
Wednesday, April 3, 2019
macOS: bash error: declare: -A: invalid option
[jerome@jeroboam] > ./avws-stores.sh
+++ dirname ./avws-stores.sh
++ cd .
++ pwd
+ SCRIPT_DIR=/Users/jerome/src/boss-sms-vas/release
+ REPO_NAME=boss-sms-vas-stores
+ declare -A AWS_S3_BUCKETS
./avws-stores.sh: line 16: declare: -A: invalid option
declare: usage: declare [-afFirtx] [-p] [name[=value] ...]
Reason: The standard macOS bash version is an antiquity.
Source: Upgrading Bash on macOS
[jerome@jeroboam] > brew install bash
[jerome@jeroboam] > sudo vi /etc/shells
/bin/bash /bin/csh /bin/ksh /bin/sh /bin/tcsh /bin/zsh /usr/local/bin/bash
[jerome@jeroboam] > chsh -s /usr/local/bin/bash
AWS: list Aurora supported PostgreSQL versions
[jerome@jeroboam] > aws rds describe-db-engine-versions --engine aurora-postgresql --region eu-west-1
[
...
{
"Engine": "aurora-postgresql",
"DBParameterGroupFamily": "aurora-postgresql10",
"SupportsLogExportsToCloudwatchLogs": false,
"SupportsReadReplica": false,
"DBEngineDescription": "Aurora (PostgreSQL)",
"SupportedEngineModes": [
"provisioned"
],
"EngineVersion": "10.6",
"DBEngineVersionDescription": "Aurora PostgreSQL (compatible with PostgreSQL 10.6)",
"ValidUpgradeTarget": []
}
]
Labels:
aws,
postgresql
Monday, April 1, 2019
Clojure spec: key required depending on another key value
;; status > 0 => msgid required (defmulti sendmt-rsp-mm (fn [rsp] (-> rsp :status (clojure.string/starts-with? "-")))) ; Actually means: status < 0 (defmethod sendmt-rsp-mm false [_] (s/keys :req-un [::status ::msgid])) (defmethod sendmt-rsp-mm true [_] (s/keys :req-un [::status ::text])) (s/def ::sendmt-rsp (s/multi-spec sendmt-rsp-mm (fn [gen-v _] gen-v)))or
(s/def ::sendmt-rsp (s/and (s/keys :req-un [::status]) #(if (clojure.string/starts-with? (:status %) "-") (contains? % :text) (contains? % :msgid))))
user> (s/valid? ::sendmt-rsp {:status "2" :text "caca"}) false user> (s/valid? ::sendmt-rsp {:status "2" :msgid "caca"}) true user> (s/valid? ::sendmt-rsp {:status "-2" :text "caca"}) true user> (s/valid? ::sendmt-rsp {:status "-2" :msgid "caca"}) false
Subscribe to:
Posts (Atom)