order by cast(number_string as bigint)

[링크 : https://beone.tistory.com/272]

Posted by 구차니

테이블 상속하니..

하위에서 값을 넣으니 부모에게도 그 값이 들어가는데

sequence는 안건드리니까 부모쪽 sequence는 증가되지 않는다.

 

아무튼.. pgadmin에서 상속하니 테이블 형상이 끌려와서

그냥 상속처럼 테이블 모양 끌어온다는 건가 해서 썼는데 그게 아니라 깜놀 -_-

 

[링크 : https://corekms.tistory.com/entry/table-inheritance상속]

Posted by 구차니

말이 복잡하네

insert into table select field from table

시에 insert 값으로 특정 상수를 넣는 방법인데..

해보니 걍.. insert into 안에 'fixed string' 식으로 항목하나 넣어주면 된다.

 

 

[링크 : https://stackoverflow.com/questions/30809384/combining-insert-select-with-constants/30809406]

'프로그램 사용 > postgreSQL' 카테고리의 다른 글

sql 문자를 숫자로 정렬하기  (0) 2019.08.16
postgresql 상속  (0) 2019.08.16
pgadmin 초기 시작시 브라우저 선택  (0) 2019.08.15
postgres sequence - auto increment  (0) 2019.08.13
postgresql 변수 타입  (0) 2019.08.12
Posted by 구차니

취향상의 문제(?)로 윈도우에서는 기본 브라우저를 chrome으로 설정하지 않는데

이래저래 pgadmin 실행시 edge로 띄우는것도 불편해서 설정을 찾는중

 

[링크 : https://stackoverflow.com/questions/50435656/pgadmin-4-always-open-in-browser-not-as-a-standalone-desktop-application/52905092]

'프로그램 사용 > postgreSQL' 카테고리의 다른 글

postgresql 상속  (0) 2019.08.16
sql 테이블에 검색한 값을 넣을때 고정값도 넣기  (0) 2019.08.16
postgres sequence - auto increment  (0) 2019.08.13
postgresql 변수 타입  (0) 2019.08.12
postgres 문자열 타입  (0) 2019.08.09
Posted by 구차니

자.. 어떻게 설계할까...

[링크 : https://akaisun.tistory.com/52]

 

+

2019.08.15

당연하지만(?) schema 식별자가 public이 아니면 넣어주어야 한다.

[링크 : https://www.postgresdba.com/bbs/board.php?bo_table=B10&wr_id=28]

Posted by 구차니

bigint(int8) 64bit

interger(int, int4) 32bit

double precision(float8 = 64bit)

real(float4 = 32bit)

 

[링크 : https://www.postgresql.org/docs/9.2/datatype.html]

 

JSON 변수 타입 접근 연산자

-> (JSON object or array)

->> (stringigy?)

tablename->'json_key'->'json_key'

[링크 : https://blog.outsider.ne.kr/1061]

Posted by 구차니

유틸리티 쓰니 text로 생성하고

기존에 다른 사람이 생성한걸 보니 character varying으로 많이 해놔서 타입을 보니.

 

text = varchar (무제한)

char = char (고정 길이)

varchar = character varying (길이 제한)

 

타입자체가 성능에 영향을 미치지는 않는다는데.. 어느게 나으려나 고민할 필요도 없는건가..

Different from other database systems, in PostgreSQL, there is no performance difference among three character types. In most situation, you should use text or varchar, and varchar(n) if you want PostgreSQL to check for the length limit.

[링크 : http://www.postgresqltutorial.com/postgresql-char-varchar-text/]

[링크 : https://codeday.me/ko/qa/20190305/2011.html]

 

 

'프로그램 사용 > postgreSQL' 카테고리의 다른 글

postgres sequence - auto increment  (0) 2019.08.13
postgresql 변수 타입  (0) 2019.08.12
postgresql - 테이블 형상 보기  (0) 2019.08.08
psql 테이블 목록보기  (0) 2019.08.08
pgfutter  (0) 2019.08.06
Posted by 구차니

mysql에서는 desc tablename으로 봤는데

postgresql에서는 아래처럼 보면 된다.

\d+ tablename

[링크 : https://stackoverflow.com/questions/109325/postgresql-describe-table]

 

+

위 링크에서 보면 oracle은

describe tablename;

인듯

'프로그램 사용 > postgreSQL' 카테고리의 다른 글

postgresql 변수 타입  (0) 2019.08.12
postgres 문자열 타입  (0) 2019.08.09
psql 테이블 목록보기  (0) 2019.08.08
pgfutter  (0) 2019.08.06
postgres \COPY  (0) 2019.08.06
Posted by 구차니

워.. \dt나 \d보다 확실하게 나오네

 

select * from pg_tables;

[링크 : https://enjoyprogramming.tistory.com/7]

'프로그램 사용 > postgreSQL' 카테고리의 다른 글

postgres 문자열 타입  (0) 2019.08.09
postgresql - 테이블 형상 보기  (0) 2019.08.08
pgfutter  (0) 2019.08.06
postgres \COPY  (0) 2019.08.06
union sql  (0) 2019.06.28
Posted by 구차니

import schema에 다가 csv 파일등을 넣어주는 녀석

go로 짰고 받아보니.. elf 실행파일인데...

 

테스트로 해보니까 걍 테이블을 text로 생성해 버린다.

그래도 최대 자릿수 찾을줄 알았는데 그게 아니라 아쉽네

[링크 : https://github.com/lukasmartinelli/pgfutter]

 

+

csv가 아닌 tsv의 경우 아래처럼 사용자 delimiter에 탭을 지정해주면 된다.

pgfutter csv -d $'\t' traffic_violations.csv

'프로그램 사용 > postgreSQL' 카테고리의 다른 글

postgresql - 테이블 형상 보기  (0) 2019.08.08
psql 테이블 목록보기  (0) 2019.08.08
postgres \COPY  (0) 2019.08.06
union sql  (0) 2019.06.28
postgresql csv update  (0) 2019.06.26
Posted by 구차니