Skip to content

Instantly share code, notes, and snippets.

@ktakashi
Created March 11, 2016 14:32
Show Gist options
  • Save ktakashi/031d74c690c328f3df9a to your computer and use it in GitHub Desktop.
Save ktakashi/031d74c690c328f3df9a to your computer and use it in GitHub Desktop.
PostgreSQL: select ${table} from ${table}
postit=> \d users
Table "public.users"
Column | Type | Modifiers
-------------+-----------------------------+-------------------------------------------------
id | integer | not null default nextval('users_seq'::regclass)
username | character varying | not null
password | character varying | not null
create_date | timestamp without time zone | default now()
Indexes:
"users_pkey" PRIMARY KEY, btree (id)
"users_username_key" UNIQUE CONSTRAINT, btree (username)
Referenced by:
TABLE "postit" CONSTRAINT "fk_pi_userid" FOREIGN KEY (userid) REFERENCES users(id)
TABLE "user_info" CONSTRAINT "fk_ui_userid" FOREIGN KEY (userid) REFERENCES users(id)
postit=> select users from users;
users
-----------------------------------------------------
(0,anonymous,anonymous,"2016-03-08 12:40:01.45153")
(1 row)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment