Skip to content

Instantly share code, notes, and snippets.

@snaketh4x0r
Created February 12, 2020 07:50
Show Gist options
  • Save snaketh4x0r/3621a5ffac5863da38873bd9a27c48c3 to your computer and use it in GitHub Desktop.
Save snaketh4x0r/3621a5ffac5863da38873bd9a27c48c3 to your computer and use it in GitHub Desktop.
postgres=# CREATE DATABASE discourse2;
CREATE DATABASE
postgres=# \c
You are now connected to database "postgres" as user "postgres".
postgres=# \c discourse2
You are now connected to database "discourse2" as user "postgres".
discourse2=# CREATE TABLE accounts(id integer PRIMARY KEY NOT NULL,address TEXT,reputation integer NOT NULL);
CREATE TABLE
discourse2=# SELECT * FROM accounts;
id | address | reputation
----+---------+------------
(0 rows)
discourse2=# INSERT INTO accounts(id,address,reputation) VALUES (1,'0x00000',0);
INSERT 0 1
discourse2=# SELECT * FROM accounts;
id | address | reputation
----+---------+------------
1 | 0x00000 | 0
(1 row)
discourse2=# INSERT INTO accounts(id,address,reputation) VALUES (2.'0x2122',0);
ERROR: syntax error at or near "'0x2122'"
LINE 1: ...RT INTO accounts(id,address,reputation) VALUES (2.'0x2122',0...
^
discourse2=# INSERT INTO accounts(id,address,reputation) VALUES (2,'0x2122',0);
INSERT 0 1
discourse2=# SELECT * FROM accounts;
id | address | reputation
----+---------+------------
1 | 0x00000 | 0
2 | 0x2122 | 0
(2 rows)
discourse2=# SELECT * FROM accounts;
id | address | reputation
----+---------+------------
1 | 0x00000 | 0
2 | 0x2122 | 0
(2 rows)
discourse2=# SELECT * FROM accounts;
id | address | reputation
----+---------+------------
2 | 0x2122 | 0
1 | 0x00000 | 15
(2 rows)
discourse2=# SELECT address from accounts;
address
---------
0x2122
0x00000
(2 rows)
discourse2=# SELECT address FROM accounts;
address
---------
0x2122
0x00000
(2 rows)
discourse2=# Update accounts set address = 0xE2d128323Cf7560a6E7a82726D7b425aEdc7a556 where id = 1;
ERROR: syntax error at or near "xE2d128323Cf7560a6E7a82726D7b425aEdc7a556"
LINE 1: Update accounts set address = 0xE2d128323Cf7560a6E7a82726D7b...
^
discourse2=# Update accounts set address = '0xE2d128323Cf7560a6E7a82726D7b425aEdc7a556' where id = 1;
UPDATE 1
discourse2=# Update accounts set address = '0xE2d128323Cf7560a6E7a82726D7b425aEdc7a556' where id = 2;
UPDATE 1
discourse2=# SELECT * FROM accounts;
id | address | reputation
----+--------------------------------------------+------------
1 | 0xE2d128323Cf7560a6E7a82726D7b425aEdc7a556 | 15
2 | 0xE2d128323Cf7560a6E7a82726D7b425aEdc7a556 | 0
(2 rows)
discourse2=#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment