Project

General

Profile

« Previous | Next » 

Revision 2036

Moved "CREATE PROCEDURAL LANGUAGE plpgsql" to main Makefile so that it would only run when the DB is created, not when the public schema is reinstalled. This is only relevant on PostgreSQL < 9.x, where the plpgsql language is not part of template0.

View differences:

schemas/vegbien.sql.make
3 3

  
4 4
selfDir="$(dirname -- "$0")"
5 5

  
6
# Not part of public schema
7
cat <<EOF
8
--
9
-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: 
10
--
11

  
12
CREATE PROCEDURAL LANGUAGE plpgsql;
13

  
14

  
15
EOF
16

  
17 6
"$selfDir/../bin/postgres_vegbien" pg_dump --schema=public --schema-only \
18 7
--no-owner --no-privileges
schemas/vegbien.my.sql
1 1
--
2
-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: 
3
--
4

  
5

  
6

  
7

  
8
--
9 2
-- PostgreSQL database dump
10 3
--
11 4

  
schemas/vegbien.sql
1 1
--
2
-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: 
3
--
4

  
5
CREATE PROCEDURAL LANGUAGE plpgsql;
6

  
7

  
8
--
9 2
-- PostgreSQL database dump
10 3
--
11 4

  
Makefile
169 169
	-echo "CREATE DATABASE vegbien WITH OWNER bien TEMPLATE template0 \
170 170
ENCODING 'UTF8' LC_COLLATE 'en_US.UTF-8' LC_CTYPE 'en_US.UTF-8';"|$(psqlAsAdmin)
171 171
	echo $(rmPublicSchema)|$(psqlAsAdmin) vegbien
172
	$(createPlpgsql)
172 173
# ignore errors if user or database exists
173 174
# drop public schema *as admin* because it starts out owned by postgres
175
createPlpgsql := echo 'CREATE PROCEDURAL LANGUAGE plpgsql;'\
176
|bin/db_dump_localize|$(psqlAsBien)
174 177

  
175 178
rm_db: _always
176 179
	@$(confirmRmDb)
......
183 186

  
184 187
schemas/install: schemas/vegbien.sql _always
185 188
	-echo "CREATE SCHEMA public;"|$(psqlAsBien)
186
	<$< bin/db_dump_localize|$(psqlAsBien)
189
	<$< $(psqlAsBien)
187 190
# ignore errors if schema exists
188 191
# public schema will be owned by bien
189 192

  

Also available in: Unified diff