回答編集履歴

3

修正

2018/04/27 16:26

投稿

sazi
sazi

スコア25138

test CHANGED
@@ -51,6 +51,8 @@
51
51
  ストアド
52
52
 
53
53
  ---
54
+
55
+ カラムを指定するだけだと曖昧と言われるので、修飾を付加します。
54
56
 
55
57
  ```SQL
56
58
 

2

修正

2018/04/27 16:26

投稿

sazi
sazi

スコア25138

test CHANGED
@@ -56,15 +56,17 @@
56
56
 
57
57
  create or replace function codes(_kind varchar(10))
58
58
 
59
- returns table(kind text, status int, value text) as $$
59
+ returns table(kind varchar(10), status int, value text) as $$
60
60
 
61
61
  begin
62
62
 
63
- return query select codelist.kind, key, codelist.value from codelist where kind = _kind;
63
+ return query select codelist.kind, key, codelist.value from codelist where codelist.kind = _kind;
64
64
 
65
65
  end;
66
66
 
67
67
  $$language plpgsql;
68
+
69
+
68
70
 
69
71
  ```
70
72
 

1

修正

2018/04/27 16:24

投稿

sazi
sazi

スコア25138

test CHANGED
@@ -56,11 +56,11 @@
56
56
 
57
57
  create or replace function codes(_kind varchar(10))
58
58
 
59
- returns table(status int, value text) as $$
59
+ returns table(kind text, status int, value text) as $$
60
60
 
61
61
  begin
62
62
 
63
- return query select key, codelist.value from codelist where kind = _kind;
63
+ return query select codelist.kind, key, codelist.value from codelist where kind = _kind;
64
64
 
65
65
  end;
66
66