pg_saurus 2.4.2 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/pg_saurus/connection_adapters/postgresql_adapter.rb +1 -0
- data/lib/pg_saurus/connection_adapters/postgresql_adapter/function_methods.rb +3 -4
- data/lib/pg_saurus/connection_adapters/postgresql_adapter/schema_methods.rb +30 -0
- data/lib/pg_saurus/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5433ba8f207d15cff07d3cd6c440c098152154fa
|
4
|
+
data.tar.gz: 82cd35bd54a2ff59cd79208b80a39a90a58003ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c38ecb6c9e1e7af4d1eae3fa6ebf8ad024279525b2f63b75e91983ff72bb521917564f2bbd762071250c769bf88e13c9ac9c07e86bee284ffe18383e8724eee
|
7
|
+
data.tar.gz: eb9a89878a34a398ce99f6648362bfd12835e1c82869f73ca001b19f8bc916ccca84b453e8d32ad18ac876701d43e461df3af4b1dfba326a91bd2273f91cddad
|
@@ -14,10 +14,8 @@ module PgSaurus::ConnectionAdapters::PostgreSQLAdapter::FunctionMethods
|
|
14
14
|
p.proname AS "Name",
|
15
15
|
pg_catalog.pg_get_function_result(p.oid) AS "Returning",
|
16
16
|
CASE
|
17
|
-
WHEN p.
|
18
|
-
WHEN p.
|
19
|
-
WHEN p.prorettype = 'pg_catalog.trigger'::pg_catalog.regtype
|
20
|
-
THEN 'trigger'
|
17
|
+
WHEN p.proiswindow THEN 'window'
|
18
|
+
WHEN p.prorettype = 'pg_catalog.trigger'::pg_catalog.regtype THEN 'trigger'
|
21
19
|
ELSE 'normal'
|
22
20
|
END AS "Type",
|
23
21
|
p.oid AS "Oid"
|
@@ -26,6 +24,7 @@ module PgSaurus::ConnectionAdapters::PostgreSQLAdapter::FunctionMethods
|
|
26
24
|
WHERE pg_catalog.pg_function_is_visible(p.oid)
|
27
25
|
AND n.nspname <> 'pg_catalog'
|
28
26
|
AND n.nspname <> 'information_schema'
|
27
|
+
AND p.proisagg <> TRUE
|
29
28
|
ORDER BY 1, 2, 3, 4;
|
30
29
|
SQL
|
31
30
|
res.inject([]) do |buffer, row|
|
@@ -55,4 +55,34 @@ module PgSaurus::ConnectionAdapters::PostgreSQLAdapter::SchemaMethods
|
|
55
55
|
|
56
56
|
public_tables + non_public_tables
|
57
57
|
end
|
58
|
+
|
59
|
+
# Provide :schema option to +rename_table+ method.
|
60
|
+
def rename_table_with_schema_option(table_name, new_name, options = {})
|
61
|
+
schema_name = options[:schema]
|
62
|
+
if schema_name
|
63
|
+
in_schema schema_name do
|
64
|
+
rename_table_without_schema_option(table_name, new_name)
|
65
|
+
end
|
66
|
+
else
|
67
|
+
rename_table_without_schema_option(table_name, new_name)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
# Execute operations in the context of the schema
|
72
|
+
def in_schema(schema_name)
|
73
|
+
search_path = current_schema_search_path
|
74
|
+
begin
|
75
|
+
execute("SET search_path TO '%s'" % schema_name)
|
76
|
+
yield
|
77
|
+
ensure
|
78
|
+
execute("SET search_path TO #{search_path};")
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
# Reads the current schema search path (it may have been altered
|
83
|
+
# from the initial value used when creating the connection)
|
84
|
+
def current_schema_search_path
|
85
|
+
select_value("SHOW search_path;")
|
86
|
+
end
|
87
|
+
|
58
88
|
end
|
data/lib/pg_saurus/version.rb
CHANGED