generated from credfeto/cs-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpgsql.schema.sql
60 lines (59 loc) · 1.84 KB
/
pgsql.schema.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
SET ANSI_NULLS ON;
SET NOCOUNT ON;
SET QUOTED_IDENTIFIER ON;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT @@VERSION;
-- create schema if not exists ethereum;
--
-- create table if not exists ethereum.account
-- (
-- id serial
-- constraint account_pk
-- primary key,
-- name varchar(200) not null,
-- address char(42) not null
-- );
--
-- alter table ethereum.account
-- owner to markr;
--
-- create or replace function account_get(id integer)
-- returns TABLE(id integer, name text, address character)
-- language sql
-- as
-- $$
-- SELECT a.id, a.name, a.address from ethereum.account a where a.id = account_get.id;
-- $$;
--
-- alter function ethereum.account_get(integer) owner to markr;
--
-- create or replace function ethereum.account_getall(address character)
-- returns TABLE(id integer, name text, address character)
-- language sql
-- as
-- $$
-- SELECT a.id, a.name, a.address from ethereum.account a where a.address = account_getall.address;
-- $$;
--
-- alter function ethereum.account_getall(char) owner to markr;
--
-- create or replace procedure ethereum.account_insert(IN name character varying, IN address character)
-- language sql
-- as
-- $$
-- INSERT INTO ethereum.account (name, address)
-- VALUES (account_insert.name, account_insert.address);
-- $$;
--
-- alter procedure ethereum.account_insert(varchar, char) owner to markr;
--
--
-- create or replace function ethereum.get_meaning_of_life_universe_and_everything()
-- returns int
-- language sql
-- AS
-- $$
-- SELECT 42;
-- $$;
--
-- alter procedure ethereum.get_meaning_of_life_universe_and_everything() owner to markr;