指定了太多的列名

时间:2018-07-31 10:56:13

标签: postgresql postgresql-9.5

我该如何处理该错误?

ERROR:  too many column names were specified

我不知道要进行这项工作我需要更改什么。 我的CREATE语句中是否确实有太多列,还是AS SELECT中的这列出错了?

CREATE TABLE planification_finale_asset2_test
(   nom,
nom_court,
serveur,
scheduled_backup,
schedule,
retention,
groupe,
remote_access,
alias,
parallelisme,
storage_nodes,
client_OS_type,
version_networker,
savesets,
ALIAS_1,
ALIAS_2,
APPLICATION,
ENVIRONNEMENT,
environnement_global,
IMPACT,
CLIENT_OPERATIONNEL,
TYPE,
SITE,
COMPOSANT_DE,
COMPOSE_DE ,
ETAT,
POIDS,
EQUIPE_EXPLOITATION,
debut_sauvegarde,
groupe_actif,
intervalle,
clones,
retention_policy,
calendrier,
commentaire,
volume_sauvegarde,
volume_externalise,
volume_replique,
"3P2I") AS
SELECT t1.*, CONCAT(groupe, ' status ', scheduled_backup) AS etat_groupe,
    CONCAT(groupe, ' status ', groupe_actif) AS etat_groupe_actif,
    t3.volume_sauvegarde, t3.volume_externalise, t3.volume_replique
from planification_client_biens_group_test t1
LEFT OUTER JOIN volumetrie_1_jour t3
    ON t1.nom LIKE CONCAT(t3.client, '%') AND
       t1.serveur = t3.serveur_court;

感谢您的帮助!

1 个答案:

答案 0 :(得分:0)

请尝试以下查询

SELECT t1.*, CONCAT(groupe, ' status ', scheduled_backup) AS etat_groupe,
    CONCAT(groupe, ' status ', groupe_actif) AS etat_groupe_actif,
    t3.volume_sauvegarde, t3.volume_externalise, t3.volume_replique
into planification_finale_asset2_test from planification_client_biens_group_test t1
LEFT OUTER JOIN volumetrie_1_jour t3
    ON t1.nom LIKE CONCAT(t3.client, '%') AND
       t1.serveur = t3.serveur_court;

它将把数据加载到表planification_finale_asset2_test中。