Re: Odd behavior with 'currval' - Mailing list pgsql-general

From Adrian Klaver
Subject Re: Odd behavior with 'currval'
Date
Msg-id 31344c43-4f1d-78bd-1a07-4e4e544a1deb@aklaver.com
Whole thread Raw
In response to Re: Odd behavior with 'currval'  (Steven Hirsch <snhirsch@gmail.com>)
Responses Re: Odd behavior with 'currval'
Re: Odd behavior with 'currval'
List pgsql-general
On 02/08/2018 10:20 AM, Steven Hirsch wrote:
> On Thu, 8 Feb 2018, Adrian Klaver wrote:
> 
>> What if you do?:
>>
>> SELECT * FROM udm_asset_type_definition_def_id_seq;
> 
> I get:
> 
> udm_asset_type_definition_def_id_seq    21    1    1    
> 9223372036854775807    1    1    32    false    true
> 
> 
>> SELECT currval('udm_asset_type_definition_id_seq');

Arrgh my mistake, the above should have been

SELECT currval('udm_asset_type_definition_def_id_seq');

> 
> I get:
> 
> [Code: , SQL State: 42P01]  ERROR: relation 
> "udm_asset_type_definition_id_seq" does not exist
>    Position: 16
> 
>> Also what happens if you do:
>>
>> pg_dump -d db_name -U some_user -s  -t udm_asset_type_definition > 
>> out.sql
> 
> This:
> 
> -- 
> -- Name: udm_asset_type_definition; Type: TABLE; Schema: main; Owner: 
> asset_registry_admins
> -- 
> 
> CREATE TABLE udm_asset_type_definition (
>      def_id bigint DEFAULT 
> nextval('udm_asset_type_definition_def_id_seq'::regclass) NOT NULL,
>      def_name character varying(32) NOT NULL,
> );
> 
> 
> ALTER TABLE udm_asset_type_definition OWNER TO asset_registry_admins;
> 
> -- 
> -- Name: udm_asset_type_definition 
> udm_asset_type_definition_def_name_key; Type: CONSTRAINT; Schema: main; 
> Owner: asset_registry_admins
> -- 
> 
> ALTER TABLE ONLY udm_asset_type_definition
>      ADD CONSTRAINT udm_asset_type_definition_def_name_key UNIQUE 
> (def_name);
> 
> -- 
> -- Name: udm_asset_type_definition; Type: ACL; Schema: main; Owner: 
> asset_registry_admins
> -- 
> 
> GRANT SELECT ON TABLE udm_asset_type_definition TO asset_registry_readers;
> GRANT ALL ON TABLE udm_asset_type_definition TO asset_registry_writers;
> 
> 
> 
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com


pgsql-general by date:

Previous
From: Melvin Davidson
Date:
Subject: Re: Odd behavior with 'currval'
Next
From: Adrian Klaver
Date:
Subject: Re: Odd behavior with 'currval'