pglite 0.2.0 → 0.2.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 609fd58663c3fe74ac615524bf32871d8f50d71eda095d4845cdaa54c7320d5d
4
- data.tar.gz: 44bd42c1c7e83ba12ca9474b2ac45e0ba43e1530a3cdb6bdd8004bbdaa5288a2
3
+ metadata.gz: 44eee8d00541b9cca01cb10784d743087892cb829edc8a4539723e43d4cfbea2
4
+ data.tar.gz: 7df1edcefbfc70072aca6df406390e741ab27a09a53b3b57f45ff3fc5bc6e4ce
5
5
  SHA512:
6
- metadata.gz: 65a0e5e17832735317ebf54cc1c7bb93b815dff2bb9b8efc534c3cf281c139012ce1e43c2b152d49d5f1e12c2f191218023433583905c2ce8408c2bc06d424d0
7
- data.tar.gz: b0365fdee8d300d6bc9c4446feb32a4ed70e66b4466ee56c1ac95773647406af899b9492ddc99ddfe3e6ef7446dcd46b8bd62693e9f649140648a16a2c4e61cc
6
+ metadata.gz: ad752efa44eddccda71f97672f3ca79db36570a79c14e1dfd9bb62014e0b6da4fefd5c6ac90117d972bd2cce6bc69e73258c2cb12d76acd58bb4bea1ba8188cc
7
+ data.tar.gz: 6f213f4204f5be3d98132fa2877ae8217d5c06aade1fb16250c1953ce1804996dc089b4da811375a964ca00b9b4a88cee320f749fbff2ee5c5ccec7833d55211
@@ -44,6 +44,26 @@ module ActiveRecord
44
44
  @prepared_statements = false
45
45
  end
46
46
 
47
+ def configure_connection(...)
48
+ super
49
+
50
+ # PGlite has not col_description function used by column definition queries
51
+ query_command(<<~SQL
52
+ CREATE OR REPLACE FUNCTION col_description(table_oid oid, column_number integer)
53
+ RETURNS text
54
+ LANGUAGE sql
55
+ STABLE
56
+ AS $$
57
+ SELECT description
58
+ FROM pg_catalog.pg_description
59
+ WHERE objoid = table_oid
60
+ AND objsubid = column_number
61
+ AND classoid = 'pg_catalog.pg_class'::regclass;
62
+ $$;
63
+ SQL
64
+ )
65
+ end
66
+
47
67
  # Stub encoders/decoders
48
68
  def add_pg_encoders = nil
49
69
 
@@ -51,24 +71,7 @@ module ActiveRecord
51
71
 
52
72
  unless method_defined?(:query_rows)
53
73
  alias_method :query_rows, :query
54
- end
55
-
56
- # TODO: col_description is not supported ???
57
- def column_definitions(table_name)
58
- query_rows(<<~SQL, "SCHEMA")
59
- SELECT a.attname, format_type(a.atttypid, a.atttypmod),
60
- pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,
61
- c.collname, '' AS comment,
62
- #{supports_identity_columns? ? "attidentity" : quote("")} AS identity,
63
- #{supports_virtual_columns? ? "attgenerated" : quote("")} as attgenerated
64
- FROM pg_attribute a
65
- LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum
66
- LEFT JOIN pg_type t ON a.atttypid = t.oid
67
- LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation
68
- WHERE a.attrelid = #{quote(quote_table_name(table_name))}::regclass
69
- AND a.attnum > 0 AND NOT a.attisdropped
70
- ORDER BY a.attnum
71
- SQL
74
+ alias_method :query_command, :exec_query
72
75
  end
73
76
 
74
77
  ::ActiveRecord::Type.add_modifier({array: true}, PostgreSQL::OID::Array, adapter: :pglite)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PGlite # :nodoc:
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pglite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladimir Dementyev