BEGIN; 이 프로시저의 시작인줄 알았는데..

트랜잭션의 시작이었구나..

 

rollback을 위해서는 savepoint를 만들어 놔야하고

문제가 없으면 commit; 으로 transaction을 완료하면 된다.

BEGIN;
UPDATE accounts SET balance = balance - 100.00
    WHERE name = 'Alice';
SAVEPOINT my_savepoint;
UPDATE accounts SET balance = balance + 100.00
    WHERE name = 'Bob';
-- oops ... forget that and use Wally's account
ROLLBACK TO my_savepoint;
UPDATE accounts SET balance = balance + 100.00
    WHERE name = 'Wally';
COMMIT;

[링크 : https://www.postgresql.org/docs/8.3/tutorial-transactions.html]

 

근데.. 이렇게 하면 WAL 로 미친듯이 써질려나?

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

postgresql select having  (0) 2019.09.24
postgresql select from , (cross join)  (0) 2019.09.24
sql 문 계산하기  (0) 2019.09.24
string_agg() + COALESCE() + DISTINCT  (0) 2019.09.23
join where와 on  (0) 2019.09.18
Posted by 구차니
Programming/node.js2019. 9. 24. 17:53

테스트용 was나 하나 짜볼까나...

 

[링크 : https://araikuma.tistory.com/459]

 

+ 2019.12.10

[링크 : https://node-postgres.com/]

'Programming > node.js' 카테고리의 다른 글

node.js JWT with refresh token  (0) 2019.12.10
node.js synchornous file write  (0) 2019.11.06
json2csv / node.js 에서 NULL 값 출력하기  (0) 2019.09.18
js nested function과 변수 scope  (0) 2019.09.15
node.js util.format / sprintf?  (0) 2019.09.10
Posted by 구차니

값이 integer면 - 해서 계산해도 된다.

우옹.. 신기하당...

 

[링크 : https://blog.naver.com/kimnx9006/220573722518]

Posted by 구차니
개소리 왈왈/컴퓨터2019. 9. 24. 14:13

회사에서 주인 없는 후지츠 U1010과 빌립 S5 발견

 

 

둘다 배터리 어댑터 없어서 이래저래 사야 하는데 후지츠 꺼는 옥션에서 1.5만에 어댑터 발견

하지만 배터리는 너무 오래된 녀석이라 없는듯 한데..

 

일단은 1.8인치 EIDE 하드..

어디서 본 것 같은 사이즈라서 예전글 보니 2710p의 하드가 ZIF EIDE 타입 하드.. 케이블 문제로 쉽진 않을듯 하니 고민..

 

멀 하든 돈 낭비에 시간낭비 일거 같은데.. 왜이렇게 이거 탐나냐.. ㅠㅠ

나온지도 12년이 된 박물관으로 가야할 녀석인데 말이야... ㅠㅠ

 

[링크 : https://katastrophos.net/.../installing-ubuntu-10-10-maverick-meerkat-on-fujitsu-u820-u2010-u2020/]

[링크 : http://www.kpug.kr/kpugfreeboard/973625]

'개소리 왈왈 > 컴퓨터' 카테고리의 다른 글

viliv S5 i-LOG  (2) 2019.09.28
계륵과 딜레마  (4) 2019.09.27
z68 보트 메모리 슬롯 불량?  (0) 2019.09.22
ADATA SSD toolbox  (0) 2019.07.14
아내의 첫(?) SSD 경험  (4) 2019.07.07
Posted by 구차니

-c로는 안되고

-o Cipher로는 되네

[링크 : https://www.tweaked.io/guide/scp/]

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

ssh 원격 명령어 실행  (0) 2021.09.29
reverse ssh  (0) 2021.01.03
ssh tunnel proxy  (0) 2019.09.20
ssh remote port forwarding  (0) 2019.01.28
reverse SSH  (0) 2018.05.14
Posted by 구차니

아래와 같이 하면 값이 없는 애는 NULL로 표기된채로 ,로 여러개 쭈르르르륵 나온다.

NULL을 해주는 이유는 NULL일 경우 값을 아예 생략해서 몇개의 값을 합친건지 알수가 없기 때문.

어떻게 보면.. DB를 DB답게 안쓰는 방법인데

여러개의 레코드를 합치다 보면 NULL의 위치가 서로 다를테니 형식을 맞추기 위함이라고 해야하려나?

 

string_agg(COALESCE(합칠변수::text,'NULL'), ',')

---

 

ms sql server 에서는 isnull로 값없는건 빠지지 않도록 해주어야 한다고..

[링크 : https://docs.microsoft.com/ko-kr/sql/t-sql/functions/string-agg-transact-sql?view=sql-server-2017]

[링크 : https://xshine.tistory.com/205]

[링크 : https://dbrang.tistory.com/1289]

 

COALESCE() 라는 함수를 지원한다고.

[링크 : http://www.postgresqltutorial.com/postgresql-isnull/]

 

The COALESCE function returns the first of its arguments that is not null. Null is returned only if all arguments are null. It is often used to substitute a default value for null values when data is retrieved for display, for example:

This returns description if it is not null, otherwise short_description if it is not null, otherwise (none).

Like a CASE expression, COALESCE only evaluates the arguments that are needed to determine the result; that is, arguments to the right of the first non-null argument are not evaluated. This SQL-standard function provides capabilities similar to NVL and IFNULL, which are used in some other database systems.

[링크 : https://www.postgresql.org/docs/9.5/functions-conditional.html]

 

[링크 : https://stackoverflow.com/.../how-to-concatenate-strings-of-a-string-field-in-a-postgresql-group-by-query]

[링크 : https://blog.gaerae.com/2015/09/postgresql-multiple-rows-and-json-or-string.html]

 

2019/09/08 - [프로그램 사용/postgreSQL] - sql 여러행을 하나로 합치기 concat

 

+

json_agg(expr) 은 delimiter 없이 JSON ARRAY 타입으로 리턴해준다.

json_agg는 string_agg와는 다르게 null을 기본으로 출력해준다.

 

+

DISTINCT를 string_arr 안에서 사용이 가능하다.

[링크 : https://yahwang.github.io/posts/46]

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

postgresql transaction begin / commit / rollback  (0) 2019.09.24
sql 문 계산하기  (0) 2019.09.24
join where와 on  (0) 2019.09.18
복수 컬럼에 대한 inner join  (0) 2019.09.18
postgresql update  (0) 2019.09.18
Posted by 구차니
개소리 왈왈/블로그2019. 9. 23. 12:35

이번달에 2개 만료 된다길래

후다닥 기부

 

작년에는 그래도 어린이집 카페 글 올리고 그래서 좀 받았는데 올해는 미미하네?

정말로 이 금액이 기부되는진 모르겠지만

가끔 카페 광고 눌러서 받는 콩으로 누군가가 조금은 더 따스해지는 한해가 되길..

Posted by 구차니
Linux2019. 9. 23. 06:57

-S로 스크린에 이름을 주고

-r -X 옵션으로 명령을 준다.

screen -S "mylittlescreen" -d -m
screen -r "mylittlescreen" -X stuff $'ls\n'

 

[링크 : https://stackoverflow.com/questions/7049252/how-to-create-a-screen-executing-given-command]

'Linux' 카테고리의 다른 글

서비스 등록 오류  (0) 2019.10.10
grep -o 매칭되는 영역만 출력하기  (0) 2019.09.25
screen 스크롤하기  (0) 2019.09.23
csv에서는 awk 보단 cut  (0) 2019.09.05
awk csv  (0) 2019.09.05
Posted by 구차니
Linux2019. 9. 23. 06:56

우오오 이런 좋은 기능이?

ctrl-a-esc

pgup/pgdn

esc

 

[링크 : https://medium.com/@erwinousy/screen-command-사용법-linux-mac-62bf5dd23110

'Linux' 카테고리의 다른 글

grep -o 매칭되는 영역만 출력하기  (0) 2019.09.25
screen 명령어와 함께 실행하기  (0) 2019.09.23
csv에서는 awk 보단 cut  (0) 2019.09.05
awk csv  (0) 2019.09.05
awk 변수 지정  (0) 2019.09.02
Posted by 구차니
개소리 왈왈/컴퓨터2019. 9. 22. 18:24

혹은 cpu 가 문제이려나?

단독으로 다 테스트 한건 아니지만

DIMM-A2 / B1에  4GB *2  하니 인식이 제대로 되네

DIMM-A1/A2 는  A2만 인식하고

DIMM-B1/B2 는 B2만 인식하는 등 먼가 이상하게 작동한다

양쪽 1번 라인이 문제인거 같은데...

 

아무튼 그래픽 카드랑은 슬롯 닦아서 어떻게 되는듯?

'개소리 왈왈 > 컴퓨터' 카테고리의 다른 글

계륵과 딜레마  (4) 2019.09.27
암만 생각해도 바보짓인데... U1010  (2) 2019.09.24
ADATA SSD toolbox  (0) 2019.07.14
아내의 첫(?) SSD 경험  (4) 2019.07.07
노트북 완전체 업그레이드  (8) 2019.06.21
Posted by 구차니