This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Product Version = NetBeans IDE 8.0.2 (Build 201411181905) Operating System = Linux version 3.16.7-7-desktop running on amd64 Java; VM; Vendor = 1.7.0_72 Runtime = Java HotSpot(TM) 64-Bit Server VM 24.72-b04 Hi When creating SQL script for inserting rows from a query result not all columns are included. Steps to reproduce: 1) Create table on PostgreSQL 9.3 database. create sequence customers_email start with 1; create table customers ( id serial, firstName varchar(255), middleInitials varchar(8), lastName varchar(255), address1 varchar(255), address2 varchar(255), city varchar(255), state varchar(8), zip integer, zipExt integer, country varchar(8), phone varchar(255), eMail varchar(255) not null default 'dummy-' || nextval('customers_email') || '@nowhere.net', eMailValid smallint not null default 1, wantsCatalog smallint not null default 0, wantsENews smallint not null default 0, wantsEReceipt smallint not null default 0, wantsEInfo smallint not null default 0, wantsEOffers smallint not null default 0, birthMonth smallint, birthDay smallint, isRewardsClubMember smallint not null default 0, createdAt timestamp not null default now(), modifiedAt timestamp not null default now(), primary key (id) ); create unique index idx_customers_email on customers(eMail); create unique index idx_customers_name_zip on customers (firstname, lastname, zip, zipext); create unique index idx_customers_name_zip_2 on customers (firstname, lastname, zip) where (zipext is null); 2) Insert some rows. insert into customers (firstName, lastname, address1, city, state, zip, phone, eMail) values ('First1', 'Last1', 'Addr1', 'City1', 'ST', 12345, '123-456-7890', 'a@b.com'); insert into customers (firstName, lastname, address1, city, state, zip, phone, eMail) values ('First2', 'Last2', 'Addr2', 'City2', 'ST', 23456, '234-567-8901', 'b@c.com'); 3) Select rows. select * from customers; 4) Highlight all rows with Ctrl+A, right-click on them and click "Show SQL Script for INSERT". INSERT INTO customers (firstname, middleinitials, lastname, address1, address2, city, "state", zip, zipext, country, phone, emailvalid, wantscatalog, wantsenews, wantsereceipt, wantseinfo, wantseoffers, birthmonth, birthday, isrewardsclubmember, createdat, modifiedat) VALUES ('First1', NULL, 'Last1', 'Addr1', NULL, 'City1', 'ST', 12345, NULL, NULL, '123-456-7890', 1, 0, 0, 0, 0, 0, NULL, NULL, 0, '2015-02-17 09:58:21.573113', '2015-02-17 09:58:21.573113'); INSERT INTO customers (firstname, middleinitials, lastname, address1, address2, city, "state", zip, zipext, country, phone, emailvalid, wantscatalog, wantsenews, wantsereceipt, wantseinfo, wantseoffers, birthmonth, birthday, isrewardsclubmember, createdat, modifiedat) VALUES ('First2', NULL, 'Last2', 'Addr2', NULL, 'City2', 'ST', 23456, NULL, NULL, '234-567-8901', 1, 0, 0, 0, 0, 0, NULL, NULL, 0, '2015-02-17 09:58:48.138743', '2015-02-17 09:58:48.138743'); Notice, column "eMail" is not included.
Thank you for your report. I know that "It's not a bug, but a feature" sounds lame, but here it is the case. This is what happens: When generating the insert, the columns are enumerated and checked whther they are autoincrement values or "normal" values. Autoincrement values are not part of the insert (for example derby does not allow inserts into autoincrement columns). In your case you might be faced with a bug in the postgresql driver. The relevant section is this: boolean autoIncrement = rsMeta.isAutoIncrement(i); This returns true for your email column. If you run this code: try( Connection con = DriverManager.getConnection(url, user, password); Statement statement = con.createStatement(); ResultSet result = statement.executeQuery("select * FROM customers"); ) { ResultSetMetaData meta = result.getMetaData(); System.out.println("#\tcolumn\tautoincrement"); for(int i = 1; i <= meta.getColumnCount(); i++) { System.out.println(String.format("%d\t%s\t%b", i, meta.getColumnName(i), meta.isAutoIncrement(i) )); } } you get this: # column autoincrement 1 id true 2 firstname false 3 middleinitials false 4 lastname false 5 address1 false 6 address2 false 7 city false 8 state false 9 zip false 10 zipext false 11 country false 12 phone false 13 email true 14 emailvalid false 15 wantscatalog false 16 wantsenews false 17 wantsereceipt false 18 wantseinfo false 19 wantseoffers false 20 birthmonth false 21 birthday false 22 isrewardsclubmember false 23 createdat false 24 modifiedat false This is plainly not true - email is _not_ autoincrement, although it could be argued, that it is generated.