Document directory
9.2.2. Case sensitivity of the identifier
From: http://bbs.chinaunix.net/viewthread.php? Tid = 812899
This problem is lost because I just got started with pgsql.
PostgreSQL is case-sensitive and converts the database object name in SQL statements to lowercase by default. Therefore, if you specify a name that is
An example is provided to briefly introduce arrays in PostgreSQL and postgresql.
PostgreSQL has many out-of-the-box data types, from standard digital data types, to geometric types, and even network data types. Although many people ignore these data types, they are one of my favorite features. The array data type, as y
PostgreSQL supports hstore to store data such as Key->value, which is in fact similar to array or JSON type. Efficient indexing is essential to the efficient use of this type of data. Let's take a look at the performance issues of two different types of indexes for the same retrieval request today.If we had such an original table. There is a Btree index based on the Str1 field.t_girl=# \d Status_check; Table "Ytt.status_check" Column |
PostgreSQL provides a powerful regular expression system that enables fuzzy queries at the database level.Regular expression matching operators:
operator
Description
Example
~
Match regular expressions, case-related
' Thomas ' ~ '. *thomas.* '
~*
Match regular expression,
Tags: src query mode postgres Type here from a JSON-formatted POSBusiness extension fields are often stored in the database using JSON-formatted data, which involves a headache, assuming that a value in the extension field should be used as a query condition, and PostgreSQL itself supports this query.Example: Suppose the Business extension field ext_data the JSON format as follows:We need to query all the data extinfo.usertype=1 in the extended field,
OriginIso=> \d+test; Table"public.test"Column| Type | Modifiers | Storage |Description--------+-----------------------+-----------+----------+-------------No| Character varying (32) | notnull | Extended |Name| Text | notnull | Extended |Indexes:"Test_pkey"PRIMARY KEY, Btree (No,"Name") has Oids:noiso= = INSERT INTO Test (no, Name) VALUES ("123","Jihite"); Error:column"name"of relation"Test"Does notExistline1:insert into Test (no, Name) VALUES ("123","Jihite"); ^When inserting the table, I am pro
Tags: column process RAM by index framework presence size namingWhen creating a table, the table name and field name must be all lowercase , and then the query will not be error-able, either full-capitalization or full-lowercase, or camel mode. As long as there are uppercase letters in the name, or all uppercase, the query must be cased correctly and wrapped in double quotation marks, otherwise it will be reported "XXX does not exist" error: "... does not exist"Names such as views, stored proced
The domestic article looked again, actually did not find the fundamental problem solution, the following will enumerate this series of problem solving method:
1. Add the following configuration in the configuration file:
spring.jpa.hibernate.naming.physical-
strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
2. Add the following annotations on the entities and attributes, respectively:
// Table Name
@Table("\"User\"")
// field
@Column("\"Name\"")
Solve f
Development colleagues said that the use of ipvs extension row-to-column application has a problem, the example of the initial use of the extension package reference: www. linuxidc. comLinux2013-10
The developer said there was a problem with the extended row-to-column application using ipvs, for example, the extension package for preliminary use reference: http://www.linuxidc.com/Linux/2013-10
The deve
A developer said that there was a problem when using postgres's extended row-to-column application. The example is as follows:
For more information about the extension package, see:
I. EnvironmentOS: CentOS 6.3DB: PostgreSQL 9.3.0
Ii. Scenarios
Create table t (day date, equipment varchar (20), output integer );Insert into t values ('2017-04-01 ', 'dat501', 2010 );Insert into t values ('2017-04-01 ', 'dat502
);create function top100cur(refcursor) returns refcursor as $$declare abcdef refcursor;beginopen $1 for select * from person limit 100;return $1;end$$language plpgsql;SELECT top100cur('abc');fetch all from "abc";
7. Open a cursor variable that is neither declare nor passed in.
-- Drop function top100cur (refcursor); Create Function top100cur (refcursor) returns refcursor as $ declare abcdef refcursor; begin -- open defg for select * From person limit 100; -- error: "defg" is not a known variab
Export table
Pg_dump-h localhost-u postgres (user name) database name (with user name by default)-T table (table name) > Dump.sql
Import Table
Psql-f Dump.sql
Example of a complete import export table
1, check the original database
-bash-3.2$ psql-u playboy-d Playboy//Original databaseWelcome to Psql 8.1.23, the PostgreSQL Interactive terminal.Type: \copyright for distribution Terms\h for help with SQ
PostgreSQL has a very useful built-in function, generate_series, which can be used to generate a series of filled data according to different rules.I. Syntax
generate_series(start,stop) --int or bigintgenerate_series(start,stop,step) --int or bigintgenerate_series(start,stop, step interval) --timestamp or timestamp with time zone
II. Application Example
1. Int type. The default valu
highgo=# Create sequence T_seq increment by 1 start with 1;CREATE sequencehighgo=# Select Nextval (' T_seq '); --View the next value in the sequence Nextval---------1 (1 rows of records) highgo= #create table t (id int default nextval (' T_seq '), name varchar);--use sequencecreate tablehighgo=# insert into T (name) VALUES (' Jasmine ') in the definition, insert 0 2highgo=# select * from T;ID |Name----+---------2 |Jasmine 3 | Lily (2 Records) highgo=# CREATE TABLE t1 (ID int,name varchar);CREA
order by id desc limit) se Lect avg (load_15) from S) where Id=new.id;return new; END; $BODY $ LANGUAGE plpgsql VOLATILE cost 100; Using Pgsql to write a trigger function, the basic idea is actually update. Add a trigger to a tableCREATE TRIGGER Trg_status_loadavg_insert After insert in asset_serverstatus for each ROW EXECUTE PROCEDURE Fn_status_loada Vg_insert (); In this way, the implementation of a field is averaged in the PostgreSQL database and
Tags: article solve problems arch economy end based on complete HTM--Case has two formats. Simple case function and case search function.--Simple Case functionCase SexWhen ' 1 ' Then ' men 'When ' 2 ' then ' women 'Else ' other ' END--case search functioncase If sex = ' 1 '
Tags: history run sts where 51cto mys SQL statement StudentCase has two formats. Simple case function and case search function.--Simple Case functionCase SexWhen ' 1 ' Then ' men 'When ' 2 ' then ' women 'Else ' other ' END--case search functioncase If sex = ' 1 ' Then ' man 'When sex = ' 2 ' Then ' women 'Else ' other
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.