Skip to content

Latest commit

 

History

History
104 lines (82 loc) · 2.15 KB

VARIOUS.md

File metadata and controls

104 lines (82 loc) · 2.15 KB

Based on

Simple test

+ psql -h localhost -p 5432 -U postgres

psql (15.1, server 0.0.0)
WARNING: psql major version 15, server major version 0.0.
Some psql features might not work.
WARNING: Console code page (437) differs from Windows code page (1252)
8-bit characters might not work correctly. See psql reference
page "Notes for Windows users" for details.
Type "help" for help.

postgres=>

psql -h localhost -p 5432 -U postgres
create table if not exists test(id int, name varchar);
insert into test values(1,'test1');
insert into test values(2,'test2');
select * from test;

+ select 1;

id | name
----+------
1 | one
2 | two
(2 rows)


postgres=>

+ \q

Prepared statement

psql -h localhost -p 5432 -U postgres
PREPARE foo(text) AS  SELECT  *   FROM    foobar WHERE   foo = $1 ;

EXECUTE foo('foo');

Protocol Flow

As per https://www.postgresql.org/docs/current/protocol-flow.html

Simple Query

Unhandled:

  • CopyInResponse
  • CopyOutResponse
receive_QueryMessage{
    try{
        foreach(queryStrings){
            if(queryString){
                return_RowDescritpion
                return_DataRow
                return_CommandComplete
            }else{
                return_EmptyQueryResponse
                return_CommandComplete
            }
        }
        return_ReadyForQuery
    }catch{
        return_ErrorResponse
    }
}

Function Call

receive_FunctionCallMessage{
    try{
        foreach(queryStrings){
            if(queryString){
                return_RowDescritpion
                return_DataRow
                return_CommandComplete
            }else{
                return_EmptyQueryResponse
                return_CommandComplete
            }
        }
        return_ReadyForQuery
    }catch{
        return_ErrorResponse
    }
}