module Pqi.Conformance.Operation.Ftablecol
( spec,
)
where
import qualified Pqi
import Pqi.Conformance.Harness
import Pqi.Conformance.Prelude
import Test.Hspec
spec :: Pqi.Adapter -> SpecWith ByteString
spec :: Adapter -> SpecWith ByteString
spec Adapter
adapter =
String -> SpecWith ByteString -> SpecWith ByteString
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"ftablecol" do
String
-> (ByteString -> IO ()) -> SpecWith (Arg (ByteString -> IO ()))
forall a.
(HasCallStack, Example a) =>
String -> a -> SpecWith (Arg a)
it String
"reports the source-column number, or zero for a computed column" \ByteString
conninfo ->
Adapter
-> ByteString -> (Connection -> IO (Maybe [Int32])) -> IO ()
forall a.
(Eq a, Show a, HasCallStack) =>
Adapter -> ByteString -> (Connection -> IO a) -> IO ()
differential Adapter
adapter ByteString
conninfo \Connection
connection -> do
result <- Connection -> ByteString -> IO (Maybe Result)
Pqi.exec Connection
connection ByteString
"select relname, relkind, 1 as computed from pg_catalog.pg_class where false"
for result \Result
r -> do
n <- Result -> IO Int32
Pqi.nfields Result
r
traverse (Pqi.ftablecol r) [0 .. n - 1]