Skip to content

Instantly share code, notes, and snippets.

View jordanlewis's full-sized avatar
👀
large data banking

Jordan Lewis jordanlewis

👀
large data banking
View GitHub Profile
root@:26257/> create database test;
CREATE DATABASE
root@:26257/> set database=test;
SET
root@:26257/test> CREATE TABLE "Employees" ("EmployeeID" SERIAL, "LastName" VARCHAR(20) NOT NULL, "FirstName" VARCHAR(10) NOT NULL, "Title" VARCHAR(30) NULL, "TitleOfCourtesy" VARCHAR(25) NULL, "BirthDate" TIMESTAMP NULL, "HireDate" TIMESTAMP NULL, "Address" VARCHAR(60) NULL, "City" VARCHAR(15) NULL, "Region" VARCHAR(15) NULL, "PostalCode" VARCHAR(10) NULL, "Country" VARCHAR(15) NULL, "HomePhone" VARCHAR(24) NULL, "Extension" VARCHAR(4) NULL, "Photo" BYTEA NULL, "Notes" TEXT NULL, "ReportsTo" INT NULL, "PhotoPath" VARCHAR(255) NULL, CONSTRAINT "PK_Employees" PRIMARY KEY ("EmployeeID"), CONSTRAINT "FK_Employees_Employees" FOREIGN KEY ("ReportsTo") REFERENCES "Employees" ("EmployeeID"), CONSTRAINT "CK_Birthdate" CHECK ("BirthDate" < current_date()));
CREATE TABLE
root@:26257/test> CREATE TABLE "Categories" ("CategoryID" SERIAL, "CategoryName" VARCHAR(15) NOT NULL, "Description" TEXT NULL, "Picture" BYTEA NULL, CONSTRAINT "P
I170206 17:27:50.257056 305 sql/executor.go:530 [client=[::1]:56597,user=jordan,n1] execRequest: set client_encoding to 'UTF8'
I170206 17:27:50.257208 305 sql/executor.go:856 [client=[::1]:56597,user=jordan,n1] executing 1/1: SET client_encoding = 'UTF8'
I170206 17:27:50.257657 305 sql/executor.go:530 [client=[::1]:56597,user=jordan,n1] execRequest: SET client_min_messages TO 'debug'
I170206 17:27:50.257728 305 sql/executor.go:856 [client=[::1]:56597,user=jordan,n1] executing 1/1: SET client_min_messages = 'debug'
I170206 17:27:50.258291 305 sql/executor.go:530 [client=[::1]:56597,user=jordan,n1] execRequest: SET standard_conforming_strings = on
I170206 17:27:50.258356 305 sql/executor.go:856 [client=[::1]:56597,user=jordan,n1] executing 1/1: SET standard_conforming_strings = 'on'
I170206 17:27:50.258618 305 sql/executor.go:530 [client=[::1]:56597,user=jordan,n1] execRequest: SET time zone 'UTC'
I170206 17:27:50.258653 305 sql/executor.go:856 [client=[::1]:56597,user=jordan,n1] executing 1/1: SET TIME
=== RUN TestDockerCLI/test_txn_prompt.tcl
expect version 5.45
argv[0] = /usr/bin/expect argv[1] = -d argv[2] = -f argv[3] = /go/src/github.com/cockroachdb/cockroach/cli/interactive_tests/test_txn_prompt.tcl argv[4] = /cockroach/cockroach
set argc 1
set argv0 "/go/src/github.com/cockroachdb/cockroach/cli/interactive_tests/test_txn_prompt.tcl"
set argv "/cockroach/cockroach"
executing commands from command file /go/src/github.com/cockroachdb/cockroach/cli/interactive_tests/test_txn_prompt.tcl
system(rm -f .cockroachdb_history_test) = 2
system(/cockroach/cockroach start & echo $! > server_pid) = 2
CockroachDB node starting at 2017-01-30 16:44:45.866807348 +0000 UTC
SELECT *
FROM (SELECT n.nspname,
c.relname,
a.attname,
a.atttypid,
a.attnotnull OR ((t.typtype = 'd') AND t.typnotnull) AS attnotnull,
a.atttypmod,
a.attlen,
ROW_NUMBER() OVER (PARTITION BY a.attrelid ORDER BY a.attnum) AS attnum,
pg_catalog.pg_get_expr(def.adbin,def.adrelid) AS adsrc,
[16:56]% gradle run jordan@Termato:~/repo/examples-orms/java/hibernate on hibernate
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:run
Dec 06, 2016 4:56:47 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {5.2.0.Final}
Dec 06, 2016 4:56:47 PM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
Dec 06, 2016 4:56:47 PM org.hibernate.cfg.Environment buildBytecodeProvider
root@:26257> set database=company;
SET
root@:26257> show tables;
+----------------+
| Table |
+----------------+
| PRODUCT_ORDERS |
| customers |
| orders |
| products |
[16:50]% gradle run jordan@Termato:~/repo/examples-orms/java/hibernate on hibernate
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:run
Dec 06, 2016 4:50:30 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {5.2.0.Final}
Dec 06, 2016 4:50:30 PM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
Dec 06, 2016 4:50:30 PM org.hibernate.cfg.Environment buildBytecodeProvider
classid | objid | objsubid | refclassid | refobjid | refobjsubid | deptype | claname | refname
1247,11632,0,1259,11631,0,i,pg_type,pg_class
1247,11636,0,1259,11635,0,i,pg_type,pg_class
1247,11640,0,1259,11639,0,i,pg_type,pg_class
1247,11643,0,1259,11642,0,i,pg_type,pg_class
1247,11646,0,1259,11645,0,i,pg_type,pg_class
1247,11650,0,1259,11649,0,i,pg_type,pg_class
1247,11654,0,1259,11653,0,i,pg_type,pg_class
1247,11658,0,1259,11657,0,i,pg_type,pg_class
SELECT *
FROM (
SELECT n.nspname,
c.relname,
a.attname,
a.atttypid,
a.attnotnull
or (
t.typtype = 'd'
AND t.typnotnull) AS attnotnull,
@jordanlewis
jordanlewis / hibernate_constraints.sql
Created November 11, 2016 15:46
Monster query that uses pg_depend
SELECT NULL::text AS pktable_cat,
pkn.nspname AS pktable_schem,
pkc.relname AS pktable_name,
pka.attname AS pkcolumn_name,
NULL::text AS fktable_cat,
fkn.nspname AS fktable_schem,
fkc.relname AS fktable_name,
fka.attname AS fkcolumn_name,
pos.n AS key_seq,
CASE con.confupdtype