The last in a series of Postgres posts, Pat Shaughnessy wrote based on he presentation at the Barcelona Ruby Conference. You can also watch the video recording of the presentation. The series was originally published in his personal blog, and we is
"Editor's note" as an open source object-relational database, Postgres has been loved by many developers. Recently, Postgres officially released version 9.5, which has been a lot of repair and functional improvements. This article will share 10
1. Prepare
Create a base table first:
CREATE TABLE mytb1 (ID serial,name character varying,age integer);To create an index on the name field:
Create INDEX Mytb1_name_index on MYTB1 (name);
To view the MYTB1 table structure:
postgres=# \d mytb1;
Recently, I have been working on a project related to PostgreSQL database, documenting the knowledge that I have learned in this process. About PostgreSQL database online already have too many relevant introduction, in order to blog the system or
Learn the PG start-up process today.The start command for pg./bin/postgres-d Path/to/data.1. Subject monitoring ProcessThe postmaster process enters an infinite loop, waiting for the client to request and provide the requested service. In an
database table has not null,default,check,unique,primary key,foreign KEY six kinds of constraints.A, NOT NULL----non-null constraintNULL indicates no data and does not represent a specific numeric value, so null in the database is not equal to NULL.
This is a creation in
Article, where the information may have evolved or changed. "' Gopackage mainimport (" FMT "" Log "" Time "" Github.com/go-xorm/xorm "_" GITHUB.COM/LIB/PQ ") var engine *xorm. Enginefunc Main () {}func init () {psqlinfo: = FMT.
--View current Server databaseSELECTDatname fromPg_database--view the created user tableSELECT * fromPg_stat_user_tables--Create a databaseCREATE DATABASE"Fxsz_lt" withOWNER=postgresencoding='UTF8'tablespace=Pg_default--lc_collate= ' Chinese
Background: Modifying the PG kernel, when creating a table, the table name cannot have the same name as the current user name.First we know that definerelation this function is the function that eventually creates the table structure, the main
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.